[PARISC] ROUND_UP macro cleanup in arch/parisc
ROUND_UP macro cleanup, use ALIGN where ever appropriate Signed-off-by: Milind Arun Choudhary <milindchoudhary@gmail.com> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
This commit is contained in:
parent
7022672e40
commit
ea74342900
|
@ -21,6 +21,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/kernel.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#include <linux/file.h>
|
#include <linux/file.h>
|
||||||
|
@ -69,7 +70,6 @@ struct getdents_callback {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
|
#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
|
||||||
#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
|
|
||||||
|
|
||||||
static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
|
static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
|
||||||
u64 ino, unsigned d_type)
|
u64 ino, unsigned d_type)
|
||||||
|
@ -77,7 +77,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
|
||||||
struct hpux_dirent __user * dirent;
|
struct hpux_dirent __user * dirent;
|
||||||
struct getdents_callback * buf = (struct getdents_callback *) __buf;
|
struct getdents_callback * buf = (struct getdents_callback *) __buf;
|
||||||
ino_t d_ino;
|
ino_t d_ino;
|
||||||
int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
|
int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(long));
|
||||||
|
|
||||||
buf->error = -EINVAL; /* only used if we fail.. */
|
buf->error = -EINVAL; /* only used if we fail.. */
|
||||||
if (reclen > buf->count)
|
if (reclen > buf->count)
|
||||||
|
@ -102,7 +102,6 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef NAME_OFFSET
|
#undef NAME_OFFSET
|
||||||
#undef ROUND_UP
|
|
||||||
|
|
||||||
int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned int count)
|
int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned int count)
|
||||||
{
|
{
|
||||||
|
|
|
@ -311,14 +311,13 @@ struct readdir32_callback {
|
||||||
int count;
|
int count;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ROUND_UP(x,a) ((__typeof__(x))(((unsigned long)(x) + ((a) - 1)) & ~((a) - 1)))
|
|
||||||
#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
|
#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
|
||||||
static int filldir32 (void *__buf, const char *name, int namlen,
|
static int filldir32 (void *__buf, const char *name, int namlen,
|
||||||
loff_t offset, u64 ino, unsigned int d_type)
|
loff_t offset, u64 ino, unsigned int d_type)
|
||||||
{
|
{
|
||||||
struct linux32_dirent __user * dirent;
|
struct linux32_dirent __user * dirent;
|
||||||
struct getdents32_callback * buf = (struct getdents32_callback *) __buf;
|
struct getdents32_callback * buf = (struct getdents32_callback *) __buf;
|
||||||
int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1, 4);
|
int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, 4);
|
||||||
u32 d_ino;
|
u32 d_ino;
|
||||||
|
|
||||||
buf->error = -EINVAL; /* only used if we fail.. */
|
buf->error = -EINVAL; /* only used if we fail.. */
|
||||||
|
|
Loading…
Reference in New Issue