Commit 95ca0bf3 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://linux-ntfs.bkbits.net/ntfs-2.6

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents f852c697 1071ed3f
......@@ -89,7 +89,7 @@ MODULE_SUPPORTED_DEVICE("ac");
static struct applicom_board {
unsigned long PhysIO;
unsigned long RamIO;
void __iomem *RamIO;
wait_queue_head_t FlagSleepSend;
long irq;
spinlock_t mutex;
......@@ -127,7 +127,7 @@ static struct miscdevice ac_miscdev = {
static int dummy; /* dev_id for request_irq() */
static int ac_register_board(unsigned long physloc, unsigned long loc,
static int ac_register_board(unsigned long physloc, void __iomem *loc,
unsigned char boardno)
{
volatile unsigned char byte_reset_it;
......@@ -180,10 +180,10 @@ void cleanup_module(void)
if (!apbs[i].RamIO)
continue;
iounmap((void *) apbs[i].RamIO);
if (apbs[i].irq)
free_irq(apbs[i].irq, &dummy);
iounmap(apbs[i].RamIO);
}
}
......@@ -193,7 +193,7 @@ int __init applicom_init(void)
{
int i, numisa = 0;
struct pci_dev *dev = NULL;
void *RamIO;
void __iomem *RamIO;
int boardno;
printk(KERN_INFO "Applicom driver: $Id: ac.c,v 1.30 2000/03/22 16:03:57 dwmw2 Exp $\n");
......@@ -223,8 +223,8 @@ int __init applicom_init(void)
applicom_pci_devnames[dev->device-1], dev->resource[0].start,
dev->irq);
if (!(boardno = ac_register_board(dev->resource[0].start,
(unsigned long)RamIO,0))) {
boardno = ac_register_board(dev->resource[0].start, RamIO,0);
if (!boardno) {
printk(KERN_INFO "ac.o: PCI Applicom device doesn't have correct signature.\n");
iounmap(RamIO);
pci_disable_device(dev);
......@@ -235,7 +235,7 @@ int __init applicom_init(void)
printk(KERN_INFO "Could not allocate IRQ %d for PCI Applicom device.\n", dev->irq);
iounmap(RamIO);
pci_disable_device(dev);
apbs[boardno - 1].RamIO = 0;
apbs[boardno - 1].RamIO = NULL;
continue;
}
......@@ -270,7 +270,7 @@ int __init applicom_init(void)
}
if (!(boardno = ac_register_board((unsigned long)mem+ (LEN_RAM_IO*i),
(unsigned long)RamIO,i+1))) {
RamIO,i+1))) {
iounmap(RamIO);
continue;
}
......@@ -280,8 +280,8 @@ int __init applicom_init(void)
if (!numisa) {
if (request_irq(irq, &ac_interrupt, SA_SHIRQ, "Applicom ISA", &dummy)) {
printk(KERN_WARNING "Could not allocate IRQ %d for ISA Applicom device.\n", irq);
iounmap((void *) RamIO);
apbs[boardno - 1].RamIO = 0;
iounmap(RamIO);
apbs[boardno - 1].RamIO = NULL;
}
else
apbs[boardno - 1].irq = irq;
......@@ -449,7 +449,7 @@ static ssize_t ac_write(struct file *file, const char __user *buf, size_t count,
because it works with 2.2 still */
{
unsigned char *from = (unsigned char *) &tmpmailbox;
unsigned long to = (unsigned long) apbs[IndexCard].RamIO + RAM_FROM_PC;
void __iomem *to = apbs[IndexCard].RamIO + RAM_FROM_PC;
int c;
for (c = 0; c < sizeof(struct mailbox); c++)
......@@ -470,7 +470,7 @@ static ssize_t ac_write(struct file *file, const char __user *buf, size_t count,
static int do_ac_read(int IndexCard, char __user *buf,
struct st_ram_io *st_loc, struct mailbox *mailbox)
{
unsigned long from = (unsigned long)apbs[IndexCard].RamIO + RAM_TO_PC;
void __iomem *from = apbs[IndexCard].RamIO + RAM_TO_PC;
unsigned char *to = (unsigned char *)&mailbox;
#ifdef DEBUG
int c;
......@@ -685,7 +685,7 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
{ /* @ ADG ou ATO selon le cas */
int i;
unsigned char IndexCard;
unsigned long pmem;
void __iomem *pmem;
int ret = 0;
volatile unsigned char byte_reset_it;
struct st_ram_io *adgl;
......
......@@ -55,8 +55,8 @@ MODULE_LICENSE("GPL");
struct vortex {
struct gameport gameport;
struct pci_dev *dev;
unsigned char *base;
unsigned char *io;
unsigned char __iomem *base;
unsigned char __iomem *io;
char phys[32];
};
......
......@@ -157,7 +157,7 @@ static int serio_raw_fetch_byte(struct serio_raw *serio_raw, char *c)
return !empty;
}
static ssize_t serio_raw_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
static ssize_t serio_raw_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
{
struct serio_raw_list *list = file->private_data;
struct serio_raw *serio_raw = list->serio_raw;
......@@ -187,7 +187,7 @@ static ssize_t serio_raw_read(struct file *file, char *buffer, size_t count, lof
return retval;
}
static ssize_t serio_raw_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
static ssize_t serio_raw_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
{
struct serio_raw_list *list = file->private_data;
ssize_t written = 0;
......
......@@ -250,12 +250,12 @@ static int tsdev_ioctl(struct inode *inode, struct file *file,
switch (cmd) {
case TS_GET_CAL:
if (copy_to_user ((void *)arg, &tsdev->cal,
if (copy_to_user ((void __user *)arg, &tsdev->cal,
sizeof (struct ts_calibration)))
retval = -EFAULT;
break;
case TS_SET_CAL:
if (copy_from_user (&tsdev->cal, (void *)arg,
if (copy_from_user (&tsdev->cal, (void __user *)arg,
sizeof (struct ts_calibration)))
retval = -EFAULT;
break;
......
......@@ -253,7 +253,7 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
return 0;
}
static int handshake (u32 *ptr, u32 mask, u32 done, int usec)
static int handshake (u32 __iomem *ptr, u32 mask, u32 done, int usec)
{
u32 result;
......@@ -272,7 +272,7 @@ static int handshake (u32 *ptr, u32 mask, u32 done, int usec)
static struct usb_ep_ops net2280_ep_ops;
static void ep_reset (struct net2280_regs *regs, struct net2280_ep *ep)
static void ep_reset (struct net2280_regs __iomem *regs, struct net2280_ep *ep)
{
u32 tmp;
......@@ -512,7 +512,7 @@ net2280_free_buffer (
static void
write_fifo (struct net2280_ep *ep, struct usb_request *req)
{
struct net2280_ep_regs *regs = ep->regs;
struct net2280_ep_regs __iomem *regs = ep->regs;
u8 *buf;
u32 tmp;
unsigned count, total;
......@@ -572,7 +572,8 @@ write_fifo (struct net2280_ep *ep, struct usb_request *req)
*/
static void out_flush (struct net2280_ep *ep)
{
u32 *statp, tmp;
u32 __iomem *statp;
u32 tmp;
ASSERT_OUT_NAKING (ep);
......@@ -605,7 +606,7 @@ static void out_flush (struct net2280_ep *ep)
static int
read_fifo (struct net2280_ep *ep, struct net2280_request *req)
{
struct net2280_ep_regs *regs = ep->regs;
struct net2280_ep_regs __iomem *regs = ep->regs;
u8 *buf = req->req.buf + req->req.actual;
unsigned count, tmp, is_short;
unsigned cleanup = 0, prevent = 0;
......@@ -732,12 +733,12 @@ static const u32 dmactl_default =
/* erratum 0116 workaround part 2 (no AUTOSTART) */
| (1 << DMA_ENABLE);
static inline void spin_stop_dma (struct net2280_dma_regs *dma)
static inline void spin_stop_dma (struct net2280_dma_regs __iomem *dma)
{
handshake (&dma->dmactl, (1 << DMA_ENABLE), 0, 50);
}
static inline void stop_dma (struct net2280_dma_regs *dma)
static inline void stop_dma (struct net2280_dma_regs __iomem *dma)
{
writel (readl (&dma->dmactl) & ~(1 << DMA_ENABLE), &dma->dmactl);
spin_stop_dma (dma);
......@@ -745,7 +746,7 @@ static inline void stop_dma (struct net2280_dma_regs *dma)
static void start_queue (struct net2280_ep *ep, u32 dmactl, u32 td_dma)
{
struct net2280_dma_regs *dma = ep->dma;
struct net2280_dma_regs __iomem *dma = ep->dma;
writel ((1 << VALID_BIT) | (ep->is_in << DMA_DIRECTION),
&dma->dmacount);
......@@ -766,7 +767,7 @@ static void start_queue (struct net2280_ep *ep, u32 dmactl, u32 td_dma)
static void start_dma (struct net2280_ep *ep, struct net2280_request *req)
{
u32 tmp;
struct net2280_dma_regs *dma = ep->dma;
struct net2280_dma_regs __iomem *dma = ep->dma;
/* FIXME can't use DMA for ZLPs */
......@@ -2579,7 +2580,7 @@ static void handle_stat1_irqs (struct net2280 *dev, u32 stat)
stat &= ~DMA_INTERRUPTS;
scratch >>= 9;
for (num = 0; scratch; num++) {
struct net2280_dma_regs *dma;
struct net2280_dma_regs __iomem *dma;
tmp = 1 << num;
if ((tmp & scratch) == 0)
......@@ -2748,7 +2749,7 @@ static int net2280_probe (struct pci_dev *pdev, const struct pci_device_id *id)
{
struct net2280 *dev;
unsigned long resource, len;
void *base = NULL;
void __iomem *base = NULL;
int retval, i;
char buf [8], *bufp;
......@@ -2806,12 +2807,12 @@ static int net2280_probe (struct pci_dev *pdev, const struct pci_device_id *id)
retval = -EFAULT;
goto done;
}
dev->regs = (struct net2280_regs *) base;
dev->usb = (struct net2280_usb_regs *) (base + 0x0080);
dev->pci = (struct net2280_pci_regs *) (base + 0x0100);
dev->dma = (struct net2280_dma_regs *) (base + 0x0180);
dev->dep = (struct net2280_dep_regs *) (base + 0x0200);
dev->epregs = (struct net2280_ep_regs *) (base + 0x0300);
dev->regs = (struct net2280_regs __iomem *) base;
dev->usb = (struct net2280_usb_regs __iomem *) (base + 0x0080);
dev->pci = (struct net2280_pci_regs __iomem *) (base + 0x0100);
dev->dma = (struct net2280_dma_regs __iomem *) (base + 0x0180);
dev->dep = (struct net2280_dep_regs __iomem *) (base + 0x0200);
dev->epregs = (struct net2280_ep_regs __iomem *) (base + 0x0300);
/* put into initial config, link up all endpoints */
writel (0, &dev->usb->usbctl);
......
......@@ -446,7 +446,7 @@ struct net2280_ep_regs { /* [11.9] */
*/
static inline u32
get_idx_reg (struct net2280_regs *regs, u32 index)
get_idx_reg (struct net2280_regs __iomem *regs, u32 index)
{
writel (index, &regs->idxaddr);
/* NOTE: synchs device/cpu memory views */
......@@ -454,7 +454,7 @@ get_idx_reg (struct net2280_regs *regs, u32 index)
}
static inline void
set_idx_reg (struct net2280_regs *regs, u32 index, u32 value)
set_idx_reg (struct net2280_regs __iomem *regs, u32 index, u32 value)
{
writel (index, &regs->idxaddr);
writel (value, &regs->idxdata);
......@@ -507,8 +507,8 @@ struct net2280_dma {
struct net2280_ep {
struct usb_ep ep;
struct net2280_ep_regs *regs;
struct net2280_dma_regs *dma;
struct net2280_ep_regs __iomem *regs;
struct net2280_dma_regs __iomem *dma;
struct net2280_dma *dummy;
dma_addr_t td_dma; /* of dummy */
struct net2280 *dev;
......@@ -539,7 +539,7 @@ static inline void allow_status (struct net2280_ep *ep)
/* count (<= 4) bytes in the next fifo write will be valid */
static inline void set_fifo_bytecount (struct net2280_ep *ep, unsigned count)
{
writeb (count, 2 + (u8 *) &ep->regs->ep_cfg);
writeb (count, 2 + (u8 __iomem *) &ep->regs->ep_cfg);
}
struct net2280_request {
......@@ -566,12 +566,12 @@ struct net2280 {
/* pci state used to access those endpoints */
struct pci_dev *pdev;
struct net2280_regs *regs;
struct net2280_usb_regs *usb;
struct net2280_pci_regs *pci;
struct net2280_dma_regs *dma;
struct net2280_dep_regs *dep;
struct net2280_ep_regs *epregs;
struct net2280_regs __iomem *regs;
struct net2280_usb_regs __iomem *usb;
struct net2280_pci_regs __iomem *pci;
struct net2280_dma_regs __iomem *dma;
struct net2280_dep_regs __iomem *dep;
struct net2280_ep_regs __iomem *epregs;
struct pci_pool *requests;
// statistics...
......
......@@ -424,7 +424,7 @@ static void _SRXAFSCM_CallBack(struct rxrpc_call *call)
{
struct afs_callback *cb, *pcb;
int loop;
u32 *fp, *bp;
__be32 *fp, *bp;
fp = rxrpc_call_alloc_scratch(call, qty);
......
......@@ -65,9 +65,9 @@ union afs_dirent {
struct {
uint8_t valid;
uint8_t unused[1];
uint16_t hash_next;
uint32_t vnode;
uint32_t unique;
__be16 hash_next;
__be32 vnode;
__be32 unique;
uint8_t name[16];
uint8_t overflow[4]; /* if any char of the name (inc
* NUL) reaches here, consume
......@@ -78,8 +78,8 @@ union afs_dirent {
/* AFS directory page header (one at the beginning of every 2048-byte chunk) */
struct afs_dir_pagehdr {
uint16_t npages;
uint16_t magic;
__be16 npages;
__be16 magic;
#define AFS_DIR_MAGIC htons(1234)
uint8_t nentries;
uint8_t bitmap[8];
......@@ -308,7 +308,7 @@ static int afs_dir_iterate_block(unsigned *fpos,
blkoff + offset * sizeof(union afs_dirent),
ntohl(dire->u.vnode),
filldir == afs_dir_lookup_filldir ?
dire->u.unique : DT_UNKNOWN);
ntohl(dire->u.unique) : DT_UNKNOWN);
if (ret < 0) {
_leave(" = 0 [full]");
return 0;
......@@ -416,7 +416,7 @@ static int afs_dir_lookup_filldir(void *_cookie, const char *name, int nlen,
struct afs_dir_lookup_cookie *cookie = _cookie;
_enter("{%s,%Zu},%s,%u,,%lu,%u",
cookie->name, cookie->nlen, name, nlen, ino, ntohl(dtype));
cookie->name, cookie->nlen, name, nlen, ino, dtype);
if (cookie->nlen != nlen || memcmp(cookie->name, name, nlen) != 0) {
_leave(" = 0 [no]");
......@@ -424,7 +424,7 @@ static int afs_dir_lookup_filldir(void *_cookie, const char *name, int nlen,
}
cookie->fid.vnode = ino;
cookie->fid.unique = ntohl(dtype);
cookie->fid.unique = dtype;
cookie->found = 1;
_leave(" = -1 [found]");
......
......@@ -307,7 +307,7 @@ int afs_rxfs_fetch_file_status(struct afs_server *server,
struct kvec piov[1];
size_t sent;
int ret;
u32 *bp;
__be32 *bp;
DECLARE_WAITQUEUE(myself, current);
......@@ -432,7 +432,7 @@ int afs_rxfs_fetch_file_data(struct afs_server *server,
struct kvec piov[1];
size_t sent;
int ret;
u32 *bp;
__be32 *bp;
DECLARE_WAITQUEUE(myself, current);
......@@ -583,7 +583,7 @@ int afs_rxfs_give_up_callback(struct afs_server *server,
struct kvec piov[1];
size_t sent;
int ret;
u32 *bp;
__be32 *bp;
DECLARE_WAITQUEUE(myself, current);
......
......@@ -101,7 +101,7 @@ static int afs_rxvl_probe(struct afs_server *server, int alloc_flags)
struct kvec piov[1];
size_t sent;
int ret;
u32 param[1];
__be32 param[1];
DECLARE_WAITQUEUE(myself, current);
......@@ -193,7 +193,7 @@ int afs_rxvl_get_entry_by_name(struct afs_server *server,
unsigned tmp;
size_t sent;
int ret, loop;
u32 *bp, param[2], zero;
__be32 *bp, param[2], zero;
_enter(",%*.*s,%u,", volnamesz, volnamesz, volname, volnamesz);
......@@ -328,7 +328,7 @@ int afs_rxvl_get_entry_by_id(struct afs_server *server,
unsigned tmp;
size_t sent;
int ret, loop;
u32 *bp, param[3];
__be32 *bp, param[3];
_enter(",%x,%d,", volid, voltype);
......@@ -464,7 +464,7 @@ int afs_rxvl_get_entry_by_id_async(struct afs_async_op *op,
struct kvec piov[1];
size_t sent;
int ret;
u32 param[3];
__be32 param[3];
_enter(",%x,%d,", volid, voltype);
......@@ -547,7 +547,8 @@ int afs_rxvl_get_entry_by_id_async(struct afs_async_op *op,
int afs_rxvl_get_entry_by_id_async2(struct afs_async_op *op,
struct afs_cache_vlocation *entry)
{
unsigned *bp, tmp;
__be32 *bp;
__u32 tmp;
int loop, ret;
_enter("{op=%p cst=%u}", op, op->call->app_call_state);
......
......@@ -603,18 +603,6 @@ static void __bio_unmap_user(struct bio *bio)
struct bio_vec *bvec;
int i;
/*
* find original bio if it was bounced
*/
if (bio->bi_private) {
/*
* someone stole our bio, must not happen
*/
BUG_ON(!bio_flagged(bio, BIO_BOUNCED));
bio = bio->bi_private;
}
/*
* make sure we dirty pages we wrote to
*/
......
......@@ -121,7 +121,8 @@ module_exit(exit_efs_fs)
static efs_block_t efs_validate_vh(struct volume_header *vh) {
int i;
unsigned int cs, csum, *ui;
__be32 cs, *ui;
int csum;
efs_block_t sblock = 0; /* shuts up gcc */
struct pt_types *pt_entry;
int pt_type, slice = -1;
......@@ -135,8 +136,8 @@ static efs_block_t efs_validate_vh(struct volume_header *vh) {
return 0;
}
ui = ((unsigned int *) (vh + 1)) - 1;
for(csum = 0; ui >= ((unsigned int *) vh);) {
ui = ((__be32 *) (vh + 1)) - 1;
for(csum = 0; ui >= ((__be32 *) vh);) {
cs = *ui--;
csum += be32_to_cpu(cs);
}
......
......@@ -10,18 +10,18 @@
#define EXT3_ACL_MAX_ENTRIES 32
typedef struct {
__u16 e_tag;
__u16 e_perm;
__u32 e_id;
__le16 e_tag;
__le16 e_perm;
__le32 e_id;
} ext3_acl_entry;
typedef struct {
__u16 e_tag;
__u16 e_perm;
__le16 e_tag;
__le16 e_perm;
} ext3_acl_entry_short;
typedef struct {
__u32 a_version;
__le32 a_version;
} ext3_acl_header;
static inline size_t ext3_acl_size(int count)
......
......@@ -91,8 +91,8 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group)
if (!bh)
ext3_error (sb, "read_block_bitmap",
"Cannot read block bitmap - "
"block_group = %d, block_bitmap = %lu",
block_group, (unsigned long) desc->bg_block_bitmap);
"block_group = %d, block_bitmap = %u",
block_group, le32_to_cpu(desc->bg_block_bitmap));
error_out:
return bh;
}
......
......@@ -64,8 +64,8 @@ read_inode_bitmap(struct super_block * sb, unsigned long block_group)
if (!bh)
ext3_error(sb, "read_inode_bitmap",
"Cannot read inode bitmap - "
"block_group = %lu, inode_bitmap = %lu",
block_group, (unsigned long) desc->bg_inode_bitmap);
"block_group = %lu, inode_bitmap = %u",
block_group, le32_to_cpu(desc->bg_inode_bitmap));
error_out:
return bh;
}
......
......@@ -305,12 +305,12 @@ static int ext3_alloc_block (handle_t *handle,
typedef struct {
u32 *p;
u32 key;
__le32 *p;
__le32 key;
struct buffer_head *bh;
} Indirect;
static inline void add_chain(Indirect *p, struct buffer_head *bh, u32 *v)
static inline void add_chain(Indirect *p, struct buffer_head *bh, __le32 *v)
{
p->key = *(p->p = v);
p->bh = bh;
......@@ -441,7 +441,7 @@ static Indirect *ext3_get_branch(struct inode *inode, int depth, int *offsets,
/* Reader: pointers */
if (!verify_chain(chain, p))
goto changed;
add_chain(++p, bh, (u32*)bh->b_data + *++offsets);
add_chain(++p, bh, (__le32*)bh->b_data + *++offsets);
/* Reader: end */
if (!p->key)
goto no_block;
......@@ -482,8 +482,8 @@ static Indirect *ext3_get_branch(struct inode *inode, int depth, int *offsets,
static unsigned long ext3_find_near(struct inode *inode, Indirect *ind)
{
struct ext3_inode_info *ei = EXT3_I(inode);
u32 *start = ind->bh ? (u32*) ind->bh->b_data : ei->i_data;
u32 *p;
__le32 *start = ind->bh ? (__le32*) ind->bh->b_data : ei->i_data;
__le32 *p;
unsigned long bg_start;
unsigned long colour;
......@@ -611,7 +611,7 @@ static int ext3_alloc_branch(handle_t *handle, struct inode *inode,
}
memset(bh->b_data, 0, blocksize);
branch[n].p = (u32*) bh->b_data + offsets[n];
branch[n].p = (__le32*) bh->b_data + offsets[n];
*branch[n].p = branch[n].key;
BUFFER_TRACE(bh, "marking uptodate");
set_buffer_uptodate(bh);
......@@ -1767,7 +1767,7 @@ static int ext3_block_truncate_page(handle_t *handle, struct page *page,
* or memcmp with zero_page, whatever is better for particular architecture.
* Linus?
*/
static inline int all_zeroes(u32 *p, u32 *q)
static inline int all_zeroes(__le32 *p, __le32 *q)
{
while (p < q)
if (*p++)
......@@ -1814,7 +1814,7 @@ static Indirect *ext3_find_shared(struct inode *inode,
int depth,
int offsets[4],
Indirect chain[4],
u32 *top)
__le32 *top)
{
Indirect *partial, *p;
int k, err;
......@@ -1834,7 +1834,7 @@ static Indirect *ext3_find_shared(struct inode *inode,
if (!partial->key && *partial->p)
/* Writer: end */
goto no_top;
for (p=partial; p>chain && all_zeroes((u32*)p->bh->b_data,p->p); p--)
for (p=partial; p>chain && all_zeroes((__le32*)p->bh->b_data,p->p); p--)
;
/*
* OK, we've found the last block that must survive. The rest of our
......@@ -1873,9 +1873,9 @@ static Indirect *ext3_find_shared(struct inode *inode,
static void
ext3_clear_blocks(handle_t *handle, struct inode *inode, struct buffer_head *bh,
unsigned long block_to_free, unsigned long count,
u32 *first, u32 *last)
__le32 *first, __le32 *last)
{
u32 *p;
__le32 *p;
if (try_to_extend_transaction(handle, inode)) {
if (bh) {
BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
......@@ -1931,15 +1931,16 @@ ext3_clear_blocks(handle_t *handle, struct inode *inode, struct buffer_head *bh,
* block pointers.
*/
static void ext3_free_data(handle_t *handle, struct inode *inode,
struct buffer_head *this_bh, u32 *first, u32 *last)
struct buffer_head *this_bh,
__le32 *first, __le32 *last)
{
unsigned long block_to_free = 0; /* Starting block # of a run */
unsigned long count = 0; /* Number of blocks in the run */
u32 *block_to_free_p = NULL; /* Pointer into inode/ind
__le32 *block_to_free_p = NULL; /* Pointer into inode/ind
corresponding to
block_to_free */
unsigned long nr; /* Current block # */
u32 *p; /* Pointer into inode/ind
__le32 *p; /* Pointer into inode/ind
for current block */
int err;
......@@ -1998,10 +1999,10 @@ static void ext3_free_data(handle_t *handle, struct inode *inode,
*/
static void ext3_free_branches(handle_t *handle, struct inode *inode,
struct buffer_head *parent_bh,
u32 *first, u32 *last, int depth)
__le32 *first, __le32 *last, int depth)
{
unsigned long nr;
u32 *p;
__le32 *p;
if (is_handle_aborted(handle))
return;
......@@ -2031,8 +2032,9 @@ static void ext3_free_branches(handle_t *handle, struct inode *inode,
/* This zaps the entire block. Bottom up. */
BUFFER_TRACE(bh, "free child branches");
ext3_free_branches(handle, inode, bh, (u32*)bh->b_data,
(u32*)bh->b_data + addr_per_block,
ext3_free_branches(handle, inode, bh,
(__le32*)bh->b_data,
(__le32*)bh->b_data + addr_per_block,
depth);
/*
......@@ -2137,13 +2139,13 @@ void ext3_truncate(struct inode * inode)
{
handle_t *handle;
struct ext3_inode_info *ei = EXT3_I(inode);
u32 *i_data = ei->i_data;
__le32 *i_data = ei->i_data;
int addr_per_block = EXT3_ADDR_PER_BLOCK(inode->i_sb);
struct address_space *mapping = inode->i_mapping;
int offsets[4];
Indirect chain[4];
Indirect *partial;
int nr = 0;
__le32 nr = 0;
int n;
long last_block;
unsigned blocksize = inode->i_sb->s_blocksize;
......@@ -2250,7 +2252,7 @@ void ext3_truncate(struct inode * inode)
/* Clear the ends of indirect blocks on the shared branch */
while (partial > chain) {
ext3_free_branches(handle, inode, partial->bh, partial->p + 1,
(u32*)partial->bh->b_data + addr_per_block,
(__le32*)partial->bh->b_data+addr_per_block,
(chain+n-1) - partial);
BUFFER_TRACE(partial->bh, "call brelse");
brelse (partial->bh);
......
......@@ -71,9 +71,6 @@ static struct buffer_head *ext3_append(handle_t *handle,
#define swap(x, y) do { typeof(x) z = x; x = y; y = z; } while (0)
#endif
typedef struct { u32 v; } le_u32;
typedef struct { u16 v; } le_u16;
#ifdef DX_DEBUG
#define dxtrace(command) command
#else
......@@ -82,22 +79,22 @@ typedef struct { u16 v; } le_u16;
struct fake_dirent
{
/*le*/u32 inode;
/*le*/u16 rec_len;
__le32 inode;
__le16 rec_len;
u8 name_len;
u8 file_type;
};
struct dx_countlimit
{
le_u16 limit;
le_u16 count;
__le16 limit;
__le16 count;
};
struct dx_entry
{
le_u32 hash;
le_u32 block;
__le32 hash;
__le32 block;
};
/*
......@@ -114,7 +111,7 @@ struct dx_root
char dotdot_name[4];
struct dx_root_info
{
le_u32 reserved_zero;
__le32 reserved_zero;
u8 hash_version;
u8 info_length; /* 8 */
u8 indirect_levels;
......@@ -184,42 +181,42 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry,
static inline unsigned dx_get_block (struct dx_entry *entry)
{
return le32_to_cpu(entry->block.v) & 0x00ffffff;
return le32_to_cpu(entry->block) & 0x00ffffff;
}
static inline void dx_set_block (struct dx_entry *entry, unsigned value)
{
entry->block.v = cpu_to_le32(value);
entry->block = cpu_to_le32(value);
}
static inline unsigned dx_get_hash (struct dx_entry *entry)
{
return le32_to_cpu(entry->hash.v);
return le32_to_cpu(entry->hash);
}
static inline void dx_set_hash (struct dx_entry *entry, unsigned value)
{
entry->hash.v = cpu_to_le32(value);
entry->hash = cpu_to_le32(value);
}
static inline unsigned dx_get_count (struct dx_entry *entries)
{
return le16_to_cpu(((struct dx_countlimit *) entries)->count.v);
return le16_to_cpu(((struct dx_countlimit *) entries)->count);
}
static inline unsigned dx_get_limit (struct dx_entry *entries)
{
return le16_to_cpu(((struct dx_countlimit *) entries)->limit.v);
return le16_to_cpu(((struct dx_countlimit *) entries)->limit);
}
static inline void dx_set_count (struct dx_entry *entries, unsigned value)
{
((struct dx_countlimit *) entries)->count.v = cpu_to_le16(value);
((struct dx_countlimit *) entries)->count = cpu_to_le16(value);
}
static inline void dx_set_limit (struct dx_entry *entries, unsigned value)
{
((struct dx_countlimit *) entries)->limit.v = cpu_to_le16(value);
((struct dx_countlimit *) entries)->limit = cpu_to_le16(value);
}
static inline unsigned dx_root_limit (struct inode *dir, unsigned infosize)
......@@ -2258,7 +2255,7 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry,
} else {
BUFFER_TRACE(new_bh, "get write access");
ext3_journal_get_write_access(handle, new_bh);
new_de->inode = le32_to_cpu(old_inode->i_ino);
new_de->inode = cpu_to_le32(old_inode->i_ino);
if (EXT3_HAS_INCOMPAT_FEATURE(new_dir->i_sb,
EXT3_FEATURE_INCOMPAT_FILETYPE))
new_de->file_type = old_de->file_type;
......@@ -2313,7 +2310,7 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry,
if (dir_bh) {
BUFFER_TRACE(dir_bh, "get_write_access");
ext3_journal_get_write_access(handle, dir_bh);
PARENT_INO(dir_bh->b_data) = le32_to_cpu(new_dir->i_ino);
PARENT_INO(dir_bh->b_data) = cpu_to_le32(new_dir->i_ino);
BUFFER_TRACE(dir_bh, "call ext3_journal_dirty_metadata");
ext3_journal_dirty_metadata(handle, dir_bh);
old_dir->i_nlink--;
......
......@@ -138,7 +138,7 @@ static void ext3_handle_error(struct super_block *sb)
struct ext3_super_block *es = EXT3_SB(sb)->s_es;
EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
es->s_state |= cpu_to_le32(EXT3_ERROR_FS);
es->s_state |= cpu_to_le16(EXT3_ERROR_FS);
if (sb->s_flags & MS_RDONLY)
return;
......@@ -377,7 +377,7 @@ static void dump_orphan_list(struct super_block *sb, struct ext3_sb_info *sbi)
"inode %s:%ld at %p: mode %o, nlink %d, next %d\n",
inode->i_sb->s_id, inode->i_ino, inode,
inode->i_mode, inode->i_nlink,
le32_to_cpu(NEXT_ORPHAN(inode)));
NEXT_ORPHAN(inode));
}
}
......@@ -391,7 +391,7 @@ void ext3_put_super (struct super_block * sb)
journal_destroy(sbi->s_journal);
if (!(sb->s_flags & MS_RDONLY)) {
EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER);
es->s_state = le16_to_cpu(sbi->s_mount_state);
es->s_state = cpu_to_le16(sbi->s_mount_state);
BUFFER_TRACE(sbi->s_sbh, "marking dirty");
mark_buffer_dirty(sbi->s_sbh);
ext3_commit_super(sb, es, 1);
......@@ -964,8 +964,7 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es,
es->s_state = cpu_to_le16(le16_to_cpu(es->s_state) & ~EXT3_VALID_FS);
#endif
if (!(__s16) le16_to_cpu(es->s_max_mnt_count))
es->s_max_mnt_count =
(__s16) cpu_to_le16(EXT3_DFL_MAX_MNT_COUNT);
es->s_max_mnt_count = cpu_to_le16(EXT3_DFL_MAX_MNT_COUNT);
es->s_mnt_count=cpu_to_le16(le16_to_cpu(es->s_mnt_count) + 1);
es->s_mtime = cpu_to_le32(get_seconds());
ext3_update_dynamic_rev(sb);
......@@ -1221,6 +1220,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
int db_count;
int i;
int needs_recovery;
__le32 features;
sbi = kmalloc(sizeof(*sbi), GFP_KERNEL);
if (!sbi)
......@@ -1313,17 +1313,18 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
* previously didn't change the revision level when setting the flags,
* so there is a chance incompat flags are set on a rev 0 filesystem.
*/
if ((i = EXT3_HAS_INCOMPAT_FEATURE(sb, ~EXT3_FEATURE_INCOMPAT_SUPP))) {
features = EXT3_HAS_INCOMPAT_FEATURE(sb, ~EXT3_FEATURE_INCOMPAT_SUPP);
if (features) {
printk(KERN_ERR "EXT3-fs: %s: couldn't mount because of "
"unsupported optional features (%x).\n",
sb->s_id, i);
sb->s_id, le32_to_cpu(features));
goto failed_mount;
}
if (!(sb->s_flags & MS_RDONLY) &&
(i = EXT3_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP))){
features = EXT3_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP);
if (!(sb->s_flags & MS_RDONLY) && features) {
printk(KERN_ERR "EXT3-fs: %s: couldn't mount RDWR because of "
"unsupported optional features (%x).\n",
sb->s_id, i);
sb->s_id, le32_to_cpu(features));
goto failed_mount;
}
blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);
......@@ -1360,7 +1361,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
}
es = (struct ext3_super_block *)(((char *)bh->b_data) + offset);
sbi->s_es = es;
if (es->s_magic != le16_to_cpu(EXT3_SUPER_MAGIC)) {
if (es->s_magic != cpu_to_le16(EXT3_SUPER_MAGIC)) {
printk (KERN_ERR
"EXT3-fs: Magic mismatch, very weird !\n");
goto failed_mount;
......@@ -1737,10 +1738,10 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
printk(KERN_ERR "EXT3-fs: I/O error on journal device\n");
goto out_journal;
}
if (ntohl(journal->j_superblock->s_nr_users) != 1) {
if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) {
printk(KERN_ERR "EXT3-fs: External journal has more than one "
"user (unsupported) - %d\n",
ntohl(journal->j_superblock->s_nr_users));
be32_to_cpu(journal->j_superblock->s_nr_users));
goto out_journal;
}
EXT3_SB(sb)->journal_bdev = bdev;
......@@ -2065,13 +2066,13 @@ int ext3_remount (struct super_block * sb, int * flags, char * data)
ext3_mark_recovery_complete(sb, es);
} else {
int ret;
__le32 ret;
if ((ret = EXT3_HAS_RO_COMPAT_FEATURE(sb,
~EXT3_FEATURE_RO_COMPAT_SUPP))) {
printk(KERN_WARNING "EXT3-fs: %s: couldn't "
"remount RDWR because of unsupported "
"optional features (%x).\n",
sb->s_id, ret);
sb->s_id, le32_to_cpu(ret));
return -EROFS;
}
/*
......
......@@ -1130,7 +1130,7 @@ static inline void ext3_xattr_hash_entry(struct ext3_xattr_header *header,
}
if (entry->e_value_block == 0 && entry->e_value_size != 0) {
__u32 *value = (__u32 *)((char *)header +
__le32 *value = (__le32 *)((char *)header +
le16_to_cpu(entry->e_value_offs));
for (n = (le32_to_cpu(entry->e_value_size) +
EXT3_XATTR_ROUND) >> EXT3_XATTR_PAD_BITS; n; n--) {
......
......@@ -25,20 +25,20 @@
#define EXT3_XATTR_INDEX_SECURITY 6
struct ext3_xattr_header {
__u32 h_magic; /* magic number for identification */
__u32 h_refcount; /* reference count */
__u32 h_blocks; /* number of disk blocks used */
__u32 h_hash; /* hash value of all attributes */
__le32 h_magic; /* magic number for identification */
__le32 h_refcount; /* reference count */
__le32 h_blocks; /* number of disk blocks used */
__le32 h_hash; /* hash value of all attributes */
__u32 h_reserved[4]; /* zero right now */
};
struct ext3_xattr_entry {
__u8 e_name_len; /* length of name */
__u8 e_name_index; /* attribute name index */
__u16 e_value_offs; /* offset in disk block of value */
__u32 e_value_block; /* disk block attribute is stored on (n/i) */
__u32 e_value_size; /* size of attribute value */
__u32 e_hash; /* hash value of name and value */
__le16 e_value_offs; /* offset in disk block of value */
__le32 e_value_block; /* disk block attribute is stored on (n/i) */
__le32 e_value_size; /* size of attribute value */
__le32 e_hash; /* hash value of name and value */
char e_name[0]; /* attribute name */
};
......
......@@ -45,13 +45,13 @@ int __fat_access(struct super_block *sb, int nr, int new_value)
}
if (sbi->fat_bits == 32) {
p_first = p_last = NULL; /* GCC needs that stuff */
next = CF_LE_L(((__u32 *) bh->b_data)[(first &
next = CF_LE_L(((__le32 *) bh->b_data)[(first &
(sb->s_blocksize - 1)) >> 2]);
/* Fscking Microsoft marketing department. Their "32" is 28. */
next &= 0x0fffffff;
} else if (sbi->fat_bits == 16) {
p_first = p_last = NULL; /* GCC needs that stuff */
next = CF_LE_W(((__u16 *) bh->b_data)[(first &
next = CF_LE_W(((__le16 *) bh->b_data)[(first &
(sb->s_blocksize - 1)) >> 1]);
} else {
p_first = &((__u8 *)bh->b_data)[first & (sb->s_blocksize - 1)];
......@@ -63,10 +63,10 @@ int __fat_access(struct super_block *sb, int nr, int new_value)
}
if (new_value != -1) {
if (sbi->fat_bits == 32) {
((__u32 *)bh->b_data)[(first & (sb->s_blocksize - 1)) >> 2]
((__le32 *)bh->b_data)[(first & (sb->s_blocksize - 1)) >> 2]
= CT_LE_L(new_value);
} else if (sbi->fat_bits == 16) {
((__u16 *)bh->b_data)[(first & (sb->s_blocksize - 1)) >> 1]
((__le16 *)bh->b_data)[(first & (sb->s_blocksize - 1)) >> 1]
= CT_LE_W(new_value);
} else {
if (nr & 1) {
......
......@@ -714,7 +714,7 @@ int fat_new_dir(struct inode *dir, struct inode *parent, int is_vfat)
{
struct buffer_head *bh;
struct msdos_dir_entry *de;
__u16 date, time;
__le16 date, time;
bh = fat_extend_dir(dir);
if (IS_ERR(bh))
......
......@@ -857,7 +857,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
brelse(bh);
goto out_invalid;
}
logical_sector_size = CF_LE_W(get_unaligned((u16 *)&b->sector_size));
logical_sector_size = CF_LE_W(get_unaligned((__le16 *)&b->sector_size));
if (!logical_sector_size
|| (logical_sector_size & (logical_sector_size - 1))
|| (logical_sector_size < 512)
......@@ -957,7 +957,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
sbi->dir_per_block_bits = ffs(sbi->dir_per_block) - 1;
sbi->dir_start = sbi->fat_start + sbi->fats * sbi->fat_length;
sbi->dir_entries = CF_LE_W(get_unaligned((u16 *)&b->dir_entries));
sbi->dir_entries = CF_LE_W(get_unaligned((__le16 *)&b->dir_entries));
if (sbi->dir_entries & (sbi->dir_per_block - 1)) {
if (!silent)
printk(KERN_ERR "FAT: bogus directroy-entries per block"
......@@ -969,7 +969,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
rootdir_sectors = sbi->dir_entries
* sizeof(struct msdos_dir_entry) / sb->s_blocksize;
sbi->data_start = sbi->dir_start + rootdir_sectors;
total_sectors = CF_LE_W(get_unaligned((u16 *)&b->sectors));
total_sectors = CF_LE_W(get_unaligned((__le16 *)&b->sectors));
if (total_sectors == 0)
total_sectors = CF_LE_L(b->total_sect);
......
......@@ -73,9 +73,9 @@ void fat_clusters_flush(struct super_block *sb)
sbi->fsinfo_sector);
} else {
if (sbi->free_clusters != -1)
fsinfo->free_clusters = CF_LE_L(sbi->free_clusters);
fsinfo->free_clusters = cpu_to_le32(sbi->free_clusters);
if (sbi->prev_free != -1)
fsinfo->next_cluster = CF_LE_L(sbi->prev_free);
fsinfo->next_cluster = cpu_to_le32(sbi->prev_free);
mark_buffer_dirty(bh);
}
brelse(bh);
......@@ -243,8 +243,7 @@ int date_dos2unix(unsigned short time,unsigned short date)
/* Convert linear UNIX date to a MS-DOS time/date pair. */
void fat_date_unix2dos(int unix_date,unsigned short *time,
unsigned short *date)
void fat_date_unix2dos(int unix_date,__le16 *time, __le16 *date)
{
int day,year,nl_day,month;
......
......@@ -405,9 +405,9 @@ void journal_commit_transaction(journal_t *journal)
jbd_debug(4, "JBD: got buffer %llu (%p)\n",
(unsigned long long)bh->b_blocknr, bh->b_data);
header = (journal_header_t *)&bh->b_data[0];
header->h_magic = htonl(JFS_MAGIC_NUMBER);
header->h_blocktype = htonl(JFS_DESCRIPTOR_BLOCK);
header->h_sequence = htonl(commit_transaction->t_tid);
header->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER);
header->h_blocktype = cpu_to_be32(JFS_DESCRIPTOR_BLOCK);
header->h_sequence = cpu_to_be32(commit_transaction->t_tid);
tagp = &bh->b_data[sizeof(journal_header_t)];
space_left = bh->b_size - sizeof(journal_header_t);
......@@ -473,8 +473,8 @@ void journal_commit_transaction(journal_t *journal)
tag_flag |= JFS_FLAG_SAME_UUID;
tag = (journal_block_tag_t *) tagp;
tag->t_blocknr = htonl(jh2bh(jh)->b_blocknr);
tag->t_flags = htonl(tag_flag);
tag->t_blocknr = cpu_to_be32(jh2bh(jh)->b_blocknr);
tag->t_flags = cpu_to_be32(tag_flag);
tagp += sizeof(journal_block_tag_t);
space_left -= sizeof(journal_block_tag_t);
......@@ -498,7 +498,7 @@ void journal_commit_transaction(journal_t *journal)
submitting the IOs. "tag" still points to
the last tag we set up. */
tag->t_flags |= htonl(JFS_FLAG_LAST_TAG);
tag->t_flags |= cpu_to_be32(JFS_FLAG_LAST_TAG);
start_journal_io:
for (i = 0; i < bufs; i++) {
......@@ -631,9 +631,9 @@ void journal_commit_transaction(journal_t *journal)
for (i = 0; i < jh2bh(descriptor)->b_size; i += 512) {
journal_header_t *tmp =
(journal_header_t*)jh2bh(descriptor)->b_data;
tmp->h_magic = htonl(JFS_MAGIC_NUMBER);
tmp->h_blocktype = htonl(JFS_COMMIT_BLOCK);
tmp->h_sequence = htonl(commit_transaction->t_tid);
tmp->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER);
tmp->h_blocktype = cpu_to_be32(JFS_COMMIT_BLOCK);
tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid);
}
JBUFFER_TRACE(descriptor, "write commit block");
......
......@@ -326,8 +326,8 @@ int journal_write_metadata_buffer(transaction_t *transaction,
/*
* Check for escaping
*/
if (*((unsigned int *)(mapped_data + new_offset)) ==
htonl(JFS_MAGIC_NUMBER)) {
if (*((__be32 *)(mapped_data + new_offset)) ==
cpu_to_be32(JFS_MAGIC_NUMBER)) {
need_copy_out = 1;
do_escape = 1;
}
......@@ -809,8 +809,8 @@ static int journal_reset(journal_t *journal)
journal_superblock_t *sb = journal->j_superblock;
unsigned int first, last;
first = ntohl(sb->s_first);
last = ntohl(sb->s_maxlen);
first = be32_to_cpu(sb->s_first);
last = be32_to_cpu(sb->s_maxlen);
journal->j_first = first;
journal->j_last = last;
......@@ -887,12 +887,12 @@ int journal_create(journal_t *journal)
/* OK, fill in the initial static fields in the new superblock */
sb = journal->j_superblock;
sb->s_header.h_magic = htonl(JFS_MAGIC_NUMBER);
sb->s_header.h_blocktype = htonl(JFS_SUPERBLOCK_V2);
sb->s_header.h_magic = cpu_to_be32(JFS_MAGIC_NUMBER);
sb->s_header.h_blocktype = cpu_to_be32(JFS_SUPERBLOCK_V2);
sb->s_blocksize = htonl(journal->j_blocksize);
sb->s_maxlen = htonl(journal->j_maxlen);
sb->s_first = htonl(1);
sb->s_blocksize = cpu_to_be32(journal->j_blocksize);
sb->s_maxlen = cpu_to_be32(journal->j_maxlen);
sb->s_first = cpu_to_be32(1);
journal->j_transaction_sequence = 1;
......@@ -935,9 +935,9 @@ void journal_update_superblock(journal_t *journal, int wait)
jbd_debug(1,"JBD: updating superblock (start %ld, seq %d, errno %d)\n",
journal->j_tail, journal->j_tail_sequence, journal->j_errno);
sb->s_sequence = htonl(journal->j_tail_sequence);
sb->s_start = htonl(journal->j_tail);
sb->s_errno = htonl(journal->j_errno);
sb->s_sequence = cpu_to_be32(journal->j_tail_sequence);
sb->s_start = cpu_to_be32(journal->j_tail);
sb->s_errno = cpu_to_be32(journal->j_errno);
spin_unlock(&journal->j_state_lock);
BUFFER_TRACE(bh, "marking dirty");
......@@ -988,13 +988,13 @@ static int journal_get_superblock(journal_t *journal)
err = -EINVAL;
if (sb->s_header.h_magic != htonl(JFS_MAGIC_NUMBER) ||
sb->s_blocksize != htonl(journal->j_blocksize)) {
if (sb->s_header.h_magic != cpu_to_be32(JFS_MAGIC_NUMBER) ||
sb->s_blocksize != cpu_to_be32(journal->j_blocksize)) {
printk(KERN_WARNING "JBD: no valid journal superblock found\n");
goto out;
}
switch(ntohl(sb->s_header.h_blocktype)) {
switch(be32_to_cpu(sb->s_header.h_blocktype)) {
case JFS_SUPERBLOCK_V1:
journal->j_format_version = 1;
break;
......@@ -1006,9 +1006,9 @@ static int journal_get_superblock(journal_t *journal)
goto out;
}
if (ntohl(sb->s_maxlen) < journal->j_maxlen)
journal->j_maxlen = ntohl(sb->s_maxlen);
else if (ntohl(sb->s_maxlen) > journal->j_maxlen) {
if (be32_to_cpu(sb->s_maxlen) < journal->j_maxlen)
journal->j_maxlen = be32_to_cpu(sb->s_maxlen);
else if (be32_to_cpu(sb->s_maxlen) > journal->j_maxlen) {
printk (KERN_WARNING "JBD: journal file too short\n");
goto out;
}
......@@ -1036,11 +1036,11 @@ static int load_superblock(journal_t *journal)
sb = journal->j_superblock;
journal->j_tail_sequence = ntohl(sb->s_sequence);
journal->j_tail = ntohl(sb->s_start);
journal->j_first = ntohl(sb->s_first);
journal->j_last = ntohl(sb->s_maxlen);
journal->j_errno = ntohl(sb->s_errno);
journal->j_tail_sequence = be32_to_cpu(sb->s_sequence);
journal->j_tail = be32_to_cpu(sb->s_start);
journal->j_first = be32_to_cpu(sb->s_first);
journal->j_last = be32_to_cpu(sb->s_maxlen);
journal->j_errno = be32_to_cpu(sb->s_errno);
return 0;
}
......@@ -1253,7 +1253,7 @@ int journal_update_format (journal_t *journal)
sb = journal->j_superblock;
switch (ntohl(sb->s_header.h_blocktype)) {
switch (be32_to_cpu(sb->s_header.h_blocktype)) {
case JFS_SUPERBLOCK_V2:
return 0;
case JFS_SUPERBLOCK_V1:
......@@ -1275,7 +1275,7 @@ static int journal_convert_superblock_v1(journal_t *journal,
/* Pre-initialise new fields to zero */
offset = ((char *) &(sb->s_feature_compat)) - ((char *) sb);
blocksize = ntohl(sb->s_blocksize);
blocksize = be32_to_cpu(sb->s_blocksize);
memset(&sb->s_feature_compat, 0, blocksize-offset);
sb->s_nr_users = cpu_to_be32(1);
......
......@@ -191,10 +191,10 @@ static int count_tags(struct buffer_head *bh, int size)
nr++;
tagp += sizeof(journal_block_tag_t);
if (!(tag->t_flags & htonl(JFS_FLAG_SAME_UUID)))
if (!(tag->t_flags & cpu_to_be32(JFS_FLAG_SAME_UUID)))
tagp += 16;
if (tag->t_flags & htonl(JFS_FLAG_LAST_TAG))
if (tag->t_flags & cpu_to_be32(JFS_FLAG_LAST_TAG))
break;
}
......@@ -239,8 +239,8 @@ int journal_recover(journal_t *journal)
if (!sb->s_start) {
jbd_debug(1, "No recovery required, last transaction %d\n",
ntohl(sb->s_sequence));
journal->j_transaction_sequence = ntohl(sb->s_sequence) + 1;
be32_to_cpu(sb->s_sequence));
journal->j_transaction_sequence = be32_to_cpu(sb->s_sequence) + 1;
return 0;
}
......@@ -295,7 +295,7 @@ int journal_skip_recovery(journal_t *journal)
++journal->j_transaction_sequence;
} else {
#ifdef CONFIG_JBD_DEBUG
int dropped = info.end_transaction - ntohl(sb->s_sequence);
int dropped = info.end_transaction - be32_to_cpu(sb->s_sequence);
#endif
jbd_debug(0,
"JBD: ignoring %d transaction%s from the journal.\n",
......@@ -331,8 +331,8 @@ static int do_one_pass(journal_t *journal,
*/
sb = journal->j_superblock;
next_commit_ID = ntohl(sb->s_sequence);
next_log_block = ntohl(sb->s_start);
next_commit_ID = be32_to_cpu(sb->s_sequence);
next_log_block = be32_to_cpu(sb->s_start);
first_commit_ID = next_commit_ID;
if (pass == PASS_SCAN)
......@@ -385,13 +385,13 @@ static int do_one_pass(journal_t *journal,
tmp = (journal_header_t *)bh->b_data;
if (tmp->h_magic != htonl(JFS_MAGIC_NUMBER)) {
if (tmp->h_magic != cpu_to_be32(JFS_MAGIC_NUMBER)) {
brelse(bh);
break;
}
blocktype = ntohl(tmp->h_blocktype);
sequence = ntohl(tmp->h_sequence);
blocktype = be32_to_cpu(tmp->h_blocktype);
sequence = be32_to_cpu(tmp->h_sequence);
jbd_debug(3, "Found magic %d, sequence %d\n",
blocktype, sequence);
......@@ -427,7 +427,7 @@ static int do_one_pass(journal_t *journal,
unsigned long io_block;
tag = (journal_block_tag_t *) tagp;
flags = ntohl(tag->t_flags);
flags = be32_to_cpu(tag->t_flags);
io_block = next_log_block++;
wrap(journal, next_log_block);
......@@ -444,7 +444,7 @@ static int do_one_pass(journal_t *journal,
unsigned long blocknr;
J_ASSERT(obh != NULL);
blocknr = ntohl(tag->t_blocknr);
blocknr = be32_to_cpu(tag->t_blocknr);
/* If the block has been
* revoked, then we're all done
......@@ -476,8 +476,8 @@ static int do_one_pass(journal_t *journal,
memcpy(nbh->b_data, obh->b_data,
journal->j_blocksize);
if (flags & JFS_FLAG_ESCAPE) {
*((unsigned int *)bh->b_data) =
htonl(JFS_MAGIC_NUMBER);
*((__be32 *)bh->b_data) =
cpu_to_be32(JFS_MAGIC_NUMBER);
}
BUFFER_TRACE(nbh, "marking dirty");
......@@ -572,13 +572,13 @@ static int scan_revoke_records(journal_t *journal, struct buffer_head *bh,
header = (journal_revoke_header_t *) bh->b_data;
offset = sizeof(journal_revoke_header_t);
max = ntohl(header->r_count);
max = be32_to_cpu(header->r_count);
while (offset < max) {
unsigned long blocknr;
int err;
blocknr = ntohl(* ((unsigned int *) (bh->b_data+offset)));
blocknr = be32_to_cpu(* ((__be32 *) (bh->b_data+offset)));
offset += 4;
err = journal_set_revoke(journal, blocknr, sequence);
if (err)
......
......@@ -566,9 +566,9 @@ static void write_one_revoke_record(journal_t *journal,
if (!descriptor)
return;
header = (journal_header_t *) &jh2bh(descriptor)->b_data[0];
header->h_magic = htonl(JFS_MAGIC_NUMBER);
header->h_blocktype = htonl(JFS_REVOKE_BLOCK);
header->h_sequence = htonl(transaction->t_tid);
header->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER);
header->h_blocktype = cpu_to_be32(JFS_REVOKE_BLOCK);
header->h_sequence = cpu_to_be32(transaction->t_tid);
/* Record it so that we can wait for IO completion later */
JBUFFER_TRACE(descriptor, "file as BJ_LogCtl");
......@@ -578,8 +578,8 @@ static void write_one_revoke_record(journal_t *journal,
*descriptorp = descriptor;
}
* ((unsigned int *)(&jh2bh(descriptor)->b_data[offset])) =
htonl(record->blocknr);
* ((__be32 *)(&jh2bh(descriptor)->b_data[offset])) =
cpu_to_be32(record->blocknr);
offset += 4;
*offsetp = offset;
}
......@@ -604,7 +604,7 @@ static void flush_descriptor(journal_t *journal,
}
header = (journal_revoke_header_t *) jh2bh(descriptor)->b_data;
header->r_count = htonl(offset);
header->r_count = cpu_to_be32(offset);
set_buffer_jwrite(bh);
BUFFER_TRACE(bh, "write");
set_buffer_dirty(bh);
......
......@@ -27,23 +27,23 @@
sb->sv_sbd2->s_tfree = *sb->sv_free_blocks
but we nevertheless keep it up to date. */
static inline u32 *get_chunk(struct super_block *sb, struct buffer_head *bh)
static inline sysv_zone_t *get_chunk(struct super_block *sb, struct buffer_head *bh)
{
char *bh_data = bh->b_data;
if (SYSV_SB(sb)->s_type == FSTYPE_SYSV4)
return (u32*)(bh_data+4);
return (sysv_zone_t*)(bh_data+4);
else
return (u32*)(bh_data+2);
return (sysv_zone_t*)(bh_data+2);
}
/* NOTE NOTE NOTE: nr is a block number _as_ _stored_ _on_ _disk_ */
void sysv_free_block(struct super_block * sb, u32 nr)
void sysv_free_block(struct super_block * sb, sysv_zone_t nr)
{
struct sysv_sb_info * sbi = SYSV_SB(sb);
struct buffer_head * bh;
u32 *blocks = sbi->s_bcache;
sysv_zone_t *blocks = sbi->s_bcache;
unsigned count;
unsigned block = fs32_to_cpu(sbi, nr);
......@@ -81,7 +81,7 @@ void sysv_free_block(struct super_block * sb, u32 nr)
return;
}
memset(bh->b_data, 0, sb->s_blocksize);
*(u16*)bh->b_data = cpu_to_fs16(sbi, count);
*(__fs16*)bh->b_data = cpu_to_fs16(sbi, count);
memcpy(get_chunk(sb,bh), blocks, count * sizeof(sysv_zone_t));
mark_buffer_dirty(bh);
set_buffer_uptodate(bh);
......@@ -96,11 +96,11 @@ void sysv_free_block(struct super_block * sb, u32 nr)
unlock_super(sb);
}
u32 sysv_new_block(struct super_block * sb)
sysv_zone_t sysv_new_block(struct super_block * sb)
{
struct sysv_sb_info *sbi = SYSV_SB(sb);
unsigned int block;
u32 nr;
sysv_zone_t nr;
struct buffer_head * bh;
unsigned count;
......@@ -133,7 +133,7 @@ u32 sysv_new_block(struct super_block * sb)
*sbi->s_bcache_count = cpu_to_fs16(sbi, 1);
goto Enospc;
}
count = fs16_to_cpu(sbi, *(u16*)bh->b_data);
count = fs16_to_cpu(sbi, *(__fs16*)bh->b_data);
if (count > sbi->s_flc_size) {
printk("sysv_new_block: free-list block with >flc_size entries\n");
brelse(bh);
......@@ -161,7 +161,7 @@ unsigned long sysv_count_free_blocks(struct super_block * sb)
int sb_count;
int count;
struct buffer_head * bh = NULL;
u32 *blocks;
sysv_zone_t *blocks;
unsigned block;
int n;
......@@ -184,15 +184,16 @@ unsigned long sysv_count_free_blocks(struct super_block * sb)
n = fs16_to_cpu(sbi, *sbi->s_bcache_count);
blocks = sbi->s_bcache;
while (1) {
sysv_zone_t zone;
if (n > sbi->s_flc_size)
goto E2big;
block = 0;
while (n && (block = blocks[--n]) != 0)
zone = 0;
while (n && (zone = blocks[--n]) != 0)
count++;
if (block == 0)
if (zone == 0)
break;
block = fs32_to_cpu(sbi, block);
block = fs32_to_cpu(sbi, zone);
if (bh)
brelse(bh);
......@@ -202,7 +203,7 @@ unsigned long sysv_count_free_blocks(struct super_block * sb)
bh = sb_bread(sb, block);
if (!bh)
goto Eio;
n = fs16_to_cpu(sbi, *(u16*)bh->b_data);
n = fs16_to_cpu(sbi, *(__fs16*)bh->b_data);
blocks = get_chunk(sb, bh);
}
if (bh)
......
......@@ -137,7 +137,7 @@ struct inode * sysv_new_inode(const struct inode * dir, mode_t mode)
struct super_block *sb = dir->i_sb;
struct sysv_sb_info *sbi = SYSV_SB(sb);
struct inode *inode;
u16 ino;
sysv_ino_t ino;
unsigned count;
inode = new_inode(sb);
......
......@@ -50,20 +50,20 @@ static int block_to_path(struct inode *inode, long block, int offsets[DEPTH])
return n;
}
static inline int block_to_cpu(struct sysv_sb_info *sbi, u32 nr)
static inline int block_to_cpu(struct sysv_sb_info *sbi, sysv_zone_t nr)
{
return sbi->s_block_base + fs32_to_cpu(sbi, nr);
}
typedef struct {
u32 *p;
u32 key;
sysv_zone_t *p;
sysv_zone_t key;
struct buffer_head *bh;
} Indirect;
static rwlock_t pointers_lock = RW_LOCK_UNLOCKED;
static inline void add_chain(Indirect *p, struct buffer_head *bh, u32 *v)
static inline void add_chain(Indirect *p, struct buffer_head *bh, sysv_zone_t *v)
{
p->key = *(p->p = v);
p->bh = bh;
......@@ -76,9 +76,9 @@ static inline int verify_chain(Indirect *from, Indirect *to)
return (from > to);
}
static inline u32 *block_end(struct buffer_head *bh)
static inline sysv_zone_t *block_end(struct buffer_head *bh)
{
return (u32*)((char*)bh->b_data + bh->b_size);
return (sysv_zone_t*)((char*)bh->b_data + bh->b_size);
}
/*
......@@ -105,7 +105,7 @@ static Indirect *get_branch(struct inode *inode,
goto failure;
if (!verify_chain(chain, p))
goto changed;
add_chain(++p, bh, (u32*)bh->b_data + *++offsets);
add_chain(++p, bh, (sysv_zone_t*)bh->b_data + *++offsets);
if (!p->key)
goto no_block;
}
......@@ -147,7 +147,7 @@ static int alloc_branch(struct inode *inode,
lock_buffer(bh);
memset(bh->b_data, 0, blocksize);
branch[n].bh = bh;
branch[n].p = (u32*) bh->b_data + offsets[n];
branch[n].p = (sysv_zone_t*) bh->b_data + offsets[n];
*branch[n].p = branch[n].key;
set_buffer_uptodate(bh);
unlock_buffer(bh);
......@@ -265,7 +265,7 @@ static int get_block(struct inode *inode, sector_t iblock, struct buffer_head *b
goto reread;
}
static inline int all_zeroes(u32 *p, u32 *q)
static inline int all_zeroes(sysv_zone_t *p, sysv_zone_t *q)
{
while (p < q)
if (*p++)
......@@ -277,7 +277,7 @@ static Indirect *find_shared(struct inode *inode,
int depth,
int offsets[],
Indirect chain[],
u32 *top)
sysv_zone_t *top)
{
Indirect *partial, *p;
int k, err;
......@@ -298,7 +298,7 @@ static Indirect *find_shared(struct inode *inode,
write_unlock(&pointers_lock);
goto no_top;
}
for (p=partial; p>chain && all_zeroes((u32*)p->bh->b_data,p->p); p--)
for (p=partial; p>chain && all_zeroes((sysv_zone_t*)p->bh->b_data,p->p); p--)
;
/*
* OK, we've found the last block that must survive. The rest of our
......@@ -322,10 +322,10 @@ static Indirect *find_shared(struct inode *inode,
return partial;
}
static inline void free_data(struct inode *inode, u32 *p, u32 *q)
static inline void free_data(struct inode *inode, sysv_zone_t *p, sysv_zone_t *q)
{
for ( ; p < q ; p++) {
u32 nr = *p;
sysv_zone_t nr = *p;
if (nr) {
*p = 0;
sysv_free_block(inode->i_sb, nr);
......@@ -334,7 +334,7 @@ static inline void free_data(struct inode *inode, u32 *p, u32 *q)
}
}
static void free_branches(struct inode *inode, u32 *p, u32 *q, int depth)
static void free_branches(struct inode *inode, sysv_zone_t *p, sysv_zone_t *q, int depth)
{
struct buffer_head * bh;
struct super_block *sb = inode->i_sb;
......@@ -342,7 +342,7 @@ static void free_branches(struct inode *inode, u32 *p, u32 *q, int depth)
if (depth--) {
for ( ; p < q ; p++) {
int block;
u32 nr = *p;
sysv_zone_t nr = *p;
if (!nr)
continue;
*p = 0;
......@@ -350,7 +350,7 @@ static void free_branches(struct inode *inode, u32 *p, u32 *q, int depth)
bh = sb_bread(sb, block);
if (!bh)
continue;
free_branches(inode, (u32*)bh->b_data,
free_branches(inode, (sysv_zone_t*)bh->b_data,
block_end(bh), depth);
bforget(bh);
sysv_free_block(sb, nr);
......@@ -362,11 +362,11 @@ static void free_branches(struct inode *inode, u32 *p, u32 *q, int depth)
void sysv_truncate (struct inode * inode)
{
u32 *i_data = SYSV_I(inode)->i_data;
sysv_zone_t *i_data = SYSV_I(inode)->i_data;
int offsets[DEPTH];
Indirect chain[DEPTH];
Indirect *partial;
int nr = 0;
sysv_zone_t nr = 0;
int n;
long iblock;
unsigned blocksize;
......
......@@ -178,16 +178,22 @@ static void detected_v7(struct sysv_sb_info *sbi)
static int detect_xenix(struct sysv_sb_info *sbi, struct buffer_head *bh)
{
struct xenix_super_block *sbd = (struct xenix_super_block *)bh->b_data;
if (sbd->s_magic == cpu_to_le32(0x2b5544))
if (*(__le32 *)&sbd->s_magic == cpu_to_le32(0x2b5544))
sbi->s_bytesex = BYTESEX_LE;
else if (sbd->s_magic == cpu_to_be32(0x2b5544))
else if (*(__be32 *)&sbd->s_magic == cpu_to_be32(0x2b5544))
sbi->s_bytesex = BYTESEX_BE;
else
return 0;
if (sbd->s_type > 2 || sbd->s_type < 1)
return 0;
switch (fs32_to_cpu(sbi, sbd->s_type)) {
case 1:
sbi->s_type = FSTYPE_XENIX;
return 1;
case 2:
sbi->s_type = FSTYPE_XENIX;
return sbd->s_type;
return 2;
default:
return 0;
}
}
static int detect_sysv(struct sysv_sb_info *sbi, struct buffer_head *bh)
......@@ -195,15 +201,18 @@ static int detect_sysv(struct sysv_sb_info *sbi, struct buffer_head *bh)
struct super_block *sb = sbi->s_sb;
/* All relevant fields are at the same offsets in R2 and R4 */
struct sysv4_super_block * sbd;
u32 type;
sbd = (struct sysv4_super_block *) (bh->b_data + BLOCK_SIZE/2);
if (sbd->s_magic == cpu_to_le32(0xfd187e20))
if (*(__le32 *)&sbd->s_magic == cpu_to_le32(0xfd187e20))
sbi->s_bytesex = BYTESEX_LE;
else if (sbd->s_magic == cpu_to_be32(0xfd187e20))
else if (*(__be32 *)&sbd->s_magic == cpu_to_be32(0xfd187e20))
sbi->s_bytesex = BYTESEX_BE;
else
return 0;
type = fs32_to_cpu(sbi, sbd->s_type);
if (fs16_to_cpu(sbi, sbd->s_nfree) == 0xffff) {
sbi->s_type = FSTYPE_AFS;
sbi->s_forced_ro = 1;
......@@ -212,18 +221,17 @@ static int detect_sysv(struct sysv_sb_info *sbi, struct buffer_head *bh)
"forcing read-only mode.\n",
sb->s_id);
}
return sbd->s_type;
return type;
}
if (fs32_to_cpu(sbi, sbd->s_time) < JAN_1_1980) {
/* this is likely to happen on SystemV2 FS */
if (sbd->s_type > 3 || sbd->s_type < 1)
if (type > 3 || type < 1)
return 0;
sbi->s_type = FSTYPE_SYSV2;
return sbd->s_type;
return type;
}
if ((sbd->s_type > 3 || sbd->s_type < 1) &&
(sbd->s_type > 0x30 || sbd->s_type < 0x10))
if ((type > 3 || type < 1) && (type > 0x30 || type < 0x10))
return 0;
/* On Interactive Unix (ISC) Version 4.0/3.x s_type field = 0x10,
......@@ -231,14 +239,14 @@ static int detect_sysv(struct sysv_sb_info *sbi, struct buffer_head *bh)
filename limit is gone. Due to lack of information about this
feature read-only mode seems to be a reasonable approach... -KGB */
if (sbd->s_type >= 0x10) {
if (type >= 0x10) {
printk("SysV FS: can't handle long file names on %s, "
"forcing read-only mode.\n", sb->s_id);
sbi->s_forced_ro = 1;
}
sbi->s_type = FSTYPE_SYSV4;
return sbd->s_type >= 0x10 ? (sbd->s_type >> 4) : sbd->s_type;
return type >= 0x10 ? type >> 4 : type;
}
static int detect_coherent(struct sysv_sb_info *sbi, struct buffer_head *bh)
......
......@@ -2,6 +2,10 @@
#define _SYSV_H
#include <linux/buffer_head.h>
typedef __u16 __bitwise __fs16;
typedef __u32 __bitwise __fs32;
#include <linux/sysv_fs.h>
/*
......@@ -38,14 +42,14 @@ struct sysv_sb_info {
different superblock layout. */
char * s_sbd1; /* entire superblock data, for part 1 */
char * s_sbd2; /* entire superblock data, for part 2 */
u16 *s_sb_fic_count; /* pointer to s_sbd->s_ninode */
u16 *s_sb_fic_inodes; /* pointer to s_sbd->s_inode */
u16 *s_sb_total_free_inodes; /* pointer to s_sbd->s_tinode */
u16 *s_bcache_count; /* pointer to s_sbd->s_nfree */
u32 *s_bcache; /* pointer to s_sbd->s_free */
u32 *s_free_blocks; /* pointer to s_sbd->s_tfree */
u32 *s_sb_time; /* pointer to s_sbd->s_time */
u32 *s_sb_state; /* pointer to s_sbd->s_state, only FSTYPE_SYSV */
__fs16 *s_sb_fic_count; /* pointer to s_sbd->s_ninode */
sysv_ino_t *s_sb_fic_inodes; /* pointer to s_sbd->s_inode */
__fs16 *s_sb_total_free_inodes; /* pointer to s_sbd->s_tinode */
__fs16 *s_bcache_count; /* pointer to s_sbd->s_nfree */
sysv_zone_t *s_bcache; /* pointer to s_sbd->s_free */
__fs32 *s_free_blocks; /* pointer to s_sbd->s_tfree */
__fs32 *s_sb_time; /* pointer to s_sbd->s_time */
__fs32 *s_sb_state; /* pointer to s_sbd->s_state, only FSTYPE_SYSV */
/* We keep those superblock entities that don't change here;
this saves us an indirection and perhaps a conversion. */
u32 s_firstinodezone; /* index of first inode zone */
......@@ -61,7 +65,7 @@ struct sysv_sb_info {
* SystemV/V7/Coherent FS inode data in memory
*/
struct sysv_inode_info {
u32 i_data[13];
__fs32 i_data[13];
u32 i_dir_start_lookup;
struct inode vfs_inode;
};
......@@ -126,8 +130,8 @@ extern void sysv_free_inode(struct inode *);
extern unsigned long sysv_count_free_inodes(struct super_block *);
/* balloc.c */
extern u32 sysv_new_block(struct super_block *);
extern void sysv_free_block(struct super_block *, u32);
extern sysv_zone_t sysv_new_block(struct super_block *);
extern void sysv_free_block(struct super_block *, sysv_zone_t);
extern unsigned long sysv_count_free_blocks(struct super_block *);
/* itree.c */
......@@ -181,58 +185,60 @@ static inline u32 PDP_swab(u32 x)
#endif
}
static inline u32 fs32_to_cpu(struct sysv_sb_info *sbi, u32 n)
static inline __u32 fs32_to_cpu(struct sysv_sb_info *sbi, __fs32 n)
{
if (sbi->s_bytesex == BYTESEX_PDP)
return PDP_swab(n);
return PDP_swab((__force __u32)n);
else if (sbi->s_bytesex == BYTESEX_LE)
return le32_to_cpu(n);
return le32_to_cpu((__force __le32)n);
else
return be32_to_cpu(n);
return be32_to_cpu((__force __be32)n);
}
static inline u32 cpu_to_fs32(struct sysv_sb_info *sbi, u32 n)
static inline __fs32 cpu_to_fs32(struct sysv_sb_info *sbi, __u32 n)
{
if (sbi->s_bytesex == BYTESEX_PDP)
return PDP_swab(n);
return (__force __fs32)PDP_swab(n);
else if (sbi->s_bytesex == BYTESEX_LE)
return cpu_to_le32(n);
return (__force __fs32)cpu_to_le32(n);
else
return cpu_to_be32(n);
return (__force __fs32)cpu_to_be32(n);
}
static inline u32 fs32_add(struct sysv_sb_info *sbi, u32 *n, int d)
static inline __fs32 fs32_add(struct sysv_sb_info *sbi, __fs32 *n, int d)
{
if (sbi->s_bytesex == BYTESEX_PDP)
return *n = PDP_swab(PDP_swab(*n)+d);
*(__u32*)n = PDP_swab(PDP_swab(*(__u32*)n)+d);
else if (sbi->s_bytesex == BYTESEX_LE)
return *n = cpu_to_le32(le32_to_cpu(*n)+d);
*(__le32*)n = cpu_to_le32(le32_to_cpu(*(__le32*)n)+d);
else
return *n = cpu_to_be32(be32_to_cpu(*n)+d);
*(__be32*)n = cpu_to_be32(be32_to_cpu(*(__be32*)n)+d);
return *n;
}
static inline u16 fs16_to_cpu(struct sysv_sb_info *sbi, u16 n)
static inline __u16 fs16_to_cpu(struct sysv_sb_info *sbi, __fs16 n)
{
if (sbi->s_bytesex != BYTESEX_BE)
return le16_to_cpu(n);
return le16_to_cpu((__force __le16)n);
else
return be16_to_cpu(n);
return be16_to_cpu((__force __be16)n);
}
static inline u16 cpu_to_fs16(struct sysv_sb_info *sbi, u16 n)
static inline __fs16 cpu_to_fs16(struct sysv_sb_info *sbi, __u16 n)
{
if (sbi->s_bytesex != BYTESEX_BE)
return cpu_to_le16(n);
return (__force __fs16)cpu_to_le16(n);
else
return cpu_to_be16(n);
return (__force __fs16)cpu_to_be16(n);
}
static inline u16 fs16_add(struct sysv_sb_info *sbi, u16 *n, int d)
static inline __fs16 fs16_add(struct sysv_sb_info *sbi, __fs16 *n, int d)
{
if (sbi->s_bytesex != BYTESEX_BE)
return *n = cpu_to_le16(le16_to_cpu(*n)+d);
*(__le16*)n = cpu_to_le16(le16_to_cpu(*(__le16 *)n)+d);
else
return *n = cpu_to_be16(be16_to_cpu(*n)+d);
*(__be16*)n = cpu_to_be16(be16_to_cpu(*(__be16 *)n)+d);
return *n;
}
#endif /* _SYSV_H */
......@@ -677,7 +677,8 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name,
de->attr = is_dir ? ATTR_DIR : ATTR_ARCH;
de->lcase = lcase;
de->adate = de->cdate = de->date = 0;
de->ctime_ms = de->ctime = de->time = 0;
de->ctime = de->time = 0;
de->ctime_ms = 0;
de->start = 0;
de->starthi = 0;
de->size = 0;
......@@ -1046,8 +1047,8 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
if (is_dir) {
int start = MSDOS_I(new_dir)->i_logstart;
dotdot_de->start = CT_LE_W(start);
dotdot_de->starthi = CT_LE_W(start>>16);
dotdot_de->start = cpu_to_le16(start);
dotdot_de->starthi = cpu_to_le16(start>>16);
mark_buffer_dirty(dotdot_bh);
old_dir->i_nlink--;
if (new_inode) {
......
......@@ -11,7 +11,7 @@
#define EFS_DIRBSIZE (1 << EFS_DIRBSIZE_BITS)
struct efs_dentry {
unsigned int inode;
__be32 inode;
unsigned char namelen;
char name[3];
};
......@@ -23,7 +23,7 @@ struct efs_dentry {
#define EFS_DIRBLK_MAGIC 0xbeef /* moo */
struct efs_dir {
unsigned short magic;
__be16 magic;
unsigned char firstused;
unsigned char slots;
......
......@@ -28,8 +28,8 @@ typedef union extent_u {
} efs_extent;
typedef struct edevs {
short odev;
unsigned int ndev;
__be16 odev;
__be32 ndev;
} efs_devs;
/*
......@@ -37,16 +37,16 @@ typedef struct edevs {
* is exactly 128 bytes long.
*/
struct efs_dinode {
u_short di_mode; /* mode and type of file */
short di_nlink; /* number of links to file */
u_short di_uid; /* owner's user id */
u_short di_gid; /* owner's group id */
int32_t di_size; /* number of bytes in file */
int32_t di_atime; /* time last accessed */
int32_t di_mtime; /* time last modified */
int32_t di_ctime; /* time created */
uint32_t di_gen; /* generation number */
short di_numextents; /* # of extents */
__be16 di_mode; /* mode and type of file */
__be16 di_nlink; /* number of links to file */
__be16 di_uid; /* owner's user id */
__be16 di_gid; /* owner's group id */
__be32 di_size; /* number of bytes in file */
__be32 di_atime; /* time last accessed */
__be32 di_mtime; /* time last modified */
__be32 di_ctime; /* time created */
__be32 di_gen; /* generation number */
__be16 di_numextents; /* # of extents */
u_char di_version; /* version of inode */
u_char di_spare; /* spare - used by AFS */
union di_addr {
......
......@@ -23,39 +23,39 @@
/* efs superblock on disk */
struct efs_super {
int32_t fs_size; /* size of filesystem, in sectors */
int32_t fs_firstcg; /* bb offset to first cg */
int32_t fs_cgfsize; /* size of cylinder group in bb's */
short fs_cgisize; /* bb's of inodes per cylinder group */
short fs_sectors; /* sectors per track */
short fs_heads; /* heads per cylinder */
short fs_ncg; /* # of cylinder groups in filesystem */
short fs_dirty; /* fs needs to be fsck'd */
int32_t fs_time; /* last super-block update */
int32_t fs_magic; /* magic number */
__be32 fs_size; /* size of filesystem, in sectors */
__be32 fs_firstcg; /* bb offset to first cg */
__be32 fs_cgfsize; /* size of cylinder group in bb's */
__be16 fs_cgisize; /* bb's of inodes per cylinder group */
__be16 fs_sectors; /* sectors per track */
__be16 fs_heads; /* heads per cylinder */
__be16 fs_ncg; /* # of cylinder groups in filesystem */
__be16 fs_dirty; /* fs needs to be fsck'd */
__be32 fs_time; /* last super-block update */
__be32 fs_magic; /* magic number */
char fs_fname[6]; /* file system name */
char fs_fpack[6]; /* file system pack name */
int32_t fs_bmsize; /* size of bitmap in bytes */
int32_t fs_tfree; /* total free data blocks */
int32_t fs_tinode; /* total free inodes */
int32_t fs_bmblock; /* bitmap location. */
int32_t fs_replsb; /* Location of replicated superblock. */
int32_t fs_lastialloc; /* last allocated inode */
__be32 fs_bmsize; /* size of bitmap in bytes */
__be32 fs_tfree; /* total free data blocks */
__be32 fs_tinode; /* total free inodes */
__be32 fs_bmblock; /* bitmap location. */
__be32 fs_replsb; /* Location of replicated superblock. */
__be32 fs_lastialloc; /* last allocated inode */
char fs_spare[20]; /* space for expansion - MUST BE ZERO */
int32_t fs_checksum; /* checksum of volume portion of fs */
__be32 fs_checksum; /* checksum of volume portion of fs */
};
/* efs superblock information in memory */
struct efs_sb_info {
int32_t fs_magic; /* superblock magic number */
int32_t fs_start; /* first block of filesystem */
int32_t first_block; /* first data block in filesystem */
int32_t total_blocks; /* total number of blocks in filesystem */
int32_t group_size; /* # of blocks a group consists of */
int32_t data_free; /* # of free data blocks */
int32_t inode_free; /* # of free inodes */
short inode_blocks; /* # of blocks used for inodes in every grp */
short total_groups; /* # of groups */
__u32 fs_magic; /* superblock magic number */
__u32 fs_start; /* first block of filesystem */
__u32 first_block; /* first data block in filesystem */
__u32 total_blocks; /* total number of blocks in filesystem */
__u32 group_size; /* # of blocks a group consists of */
__u32 data_free; /* # of free data blocks */
__u32 inode_free; /* # of free inodes */
__u16 inode_blocks; /* # of blocks used for inodes in every grp */
__u16 total_groups; /* # of groups */
};
#endif /* __EFS_FS_SB_H__ */
......
......@@ -17,26 +17,26 @@
struct volume_directory {
char vd_name[VDNAMESIZE]; /* name */
int vd_lbn; /* logical block number */
int vd_nbytes; /* file length in bytes */
__be32 vd_lbn; /* logical block number */
__be32 vd_nbytes; /* file length in bytes */
};
struct partition_table { /* one per logical partition */
int pt_nblks; /* # of logical blks in partition */
int pt_firstlbn; /* first lbn of partition */
int pt_type; /* use of partition */
__be32 pt_nblks; /* # of logical blks in partition */
__be32 pt_firstlbn; /* first lbn of partition */
__be32 pt_type; /* use of partition */
};
struct volume_header {
int vh_magic; /* identifies volume header */
short vh_rootpt; /* root partition number */
short vh_swappt; /* swap partition number */
__be32 vh_magic; /* identifies volume header */
__be16 vh_rootpt; /* root partition number */
__be16 vh_swappt; /* swap partition number */
char vh_bootfile[BFNAMESIZE]; /* name of file to boot */
char pad[48]; /* device param space */
struct volume_directory vh_vd[NVDIR]; /* other vol hdr contents */
struct partition_table vh_pt[NPARTAB]; /* device partition layout */
int vh_csum; /* volume header checksum */
int vh_fill; /* fill out to 512 bytes */
__be32 vh_csum; /* volume header checksum */
__be32 vh_fill; /* fill out to 512 bytes */
};
/* partition type sysv is used for EFS format CD-ROM partitions */
......
......@@ -129,14 +129,14 @@ struct statfs;
*/
struct ext3_group_desc
{
__u32 bg_block_bitmap; /* Blocks bitmap block */
__u32 bg_inode_bitmap; /* Inodes bitmap block */
__u32 bg_inode_table; /* Inodes table block */
__u16 bg_free_blocks_count; /* Free blocks count */
__u16 bg_free_inodes_count; /* Free inodes count */
__u16 bg_used_dirs_count; /* Directories count */
__le32 bg_block_bitmap; /* Blocks bitmap block */
__le32 bg_inode_bitmap; /* Inodes bitmap block */
__le32 bg_inode_table; /* Inodes table block */
__le16 bg_free_blocks_count; /* Free blocks count */
__le16 bg_free_inodes_count; /* Free inodes count */
__le16 bg_used_dirs_count; /* Directories count */
__u16 bg_pad;
__u32 bg_reserved[3];
__le32 bg_reserved[3];
};
/*
......@@ -213,17 +213,17 @@ struct ext3_group_desc
* Structure of an inode on the disk
*/
struct ext3_inode {
__u16 i_mode; /* File mode */
__u16 i_uid; /* Low 16 bits of Owner Uid */
__u32 i_size; /* Size in bytes */
__u32 i_atime; /* Access time */
__u32 i_ctime; /* Creation time */
__u32 i_mtime; /* Modification time */
__u32 i_dtime; /* Deletion Time */
__u16 i_gid; /* Low 16 bits of Group Id */
__u16 i_links_count; /* Links count */
__u32 i_blocks; /* Blocks count */
__u32 i_flags; /* File flags */
__le16 i_mode; /* File mode */
__le16 i_uid; /* Low 16 bits of Owner Uid */
__le32 i_size; /* Size in bytes */
__le32 i_atime; /* Access time */
__le32 i_ctime; /* Creation time */
__le32 i_mtime; /* Modification time */
__le32 i_dtime; /* Deletion Time */
__le16 i_gid; /* Low 16 bits of Group Id */
__le16 i_links_count; /* Links count */
__le32 i_blocks; /* Blocks count */
__le32 i_flags; /* File flags */
union {
struct {
__u32 l_i_reserved1;
......@@ -235,18 +235,18 @@ struct ext3_inode {
__u32 m_i_reserved1;
} masix1;
} osd1; /* OS dependent 1 */
__u32 i_block[EXT3_N_BLOCKS];/* Pointers to blocks */
__u32 i_generation; /* File version (for NFS) */
__u32 i_file_acl; /* File ACL */
__u32 i_dir_acl; /* Directory ACL */
__u32 i_faddr; /* Fragment address */
__le32 i_block[EXT3_N_BLOCKS];/* Pointers to blocks */
__le32 i_generation; /* File version (for NFS) */
__le32 i_file_acl; /* File ACL */
__le32 i_dir_acl; /* Directory ACL */
__le32 i_faddr; /* Fragment address */
union {
struct {
__u8 l_i_frag; /* Fragment number */
__u8 l_i_fsize; /* Fragment size */
__u16 i_pad1;
__u16 l_i_uid_high; /* these 2 fields */
__u16 l_i_gid_high; /* were reserved2[0] */
__le16 l_i_uid_high; /* these 2 fields */
__le16 l_i_gid_high; /* were reserved2[0] */
__u32 l_i_reserved2;
} linux2;
struct {
......@@ -364,31 +364,31 @@ struct ext3_inode {
* Structure of the super block
*/
struct ext3_super_block {
/*00*/ __u32 s_inodes_count; /* Inodes count */
__u32 s_blocks_count; /* Blocks count */
__u32 s_r_blocks_count; /* Reserved blocks count */
__u32 s_free_blocks_count; /* Free blocks count */
/*10*/ __u32 s_free_inodes_count; /* Free inodes count */
__u32 s_first_data_block; /* First Data Block */
__u32 s_log_block_size; /* Block size */
__s32 s_log_frag_size; /* Fragment size */
/*20*/ __u32 s_blocks_per_group; /* # Blocks per group */
__u32 s_frags_per_group; /* # Fragments per group */
__u32 s_inodes_per_group; /* # Inodes per group */
__u32 s_mtime; /* Mount time */
/*30*/ __u32 s_wtime; /* Write time */
__u16 s_mnt_count; /* Mount count */
__s16 s_max_mnt_count; /* Maximal mount count */
__u16 s_magic; /* Magic signature */
__u16 s_state; /* File system state */
__u16 s_errors; /* Behaviour when detecting errors */
__u16 s_minor_rev_level; /* minor revision level */
/*40*/ __u32 s_lastcheck; /* time of last check */
__u32 s_checkinterval; /* max. time between checks */
__u32 s_creator_os; /* OS */
__u32 s_rev_level; /* Revision level */
/*50*/ __u16 s_def_resuid; /* Default uid for reserved blocks */
__u16 s_def_resgid; /* Default gid for reserved blocks */
/*00*/ __le32 s_inodes_count; /* Inodes count */
__le32 s_blocks_count; /* Blocks count */
__le32 s_r_blocks_count; /* Reserved blocks count */
__le32 s_free_blocks_count; /* Free blocks count */
/*10*/ __le32 s_free_inodes_count; /* Free inodes count */
__le32 s_first_data_block; /* First Data Block */
__le32 s_log_block_size; /* Block size */
__le32 s_log_frag_size; /* Fragment size */
/*20*/ __le32 s_blocks_per_group; /* # Blocks per group */
__le32 s_frags_per_group; /* # Fragments per group */
__le32 s_inodes_per_group; /* # Inodes per group */
__le32 s_mtime; /* Mount time */
/*30*/ __le32 s_wtime; /* Write time */
__le16 s_mnt_count; /* Mount count */
__le16 s_max_mnt_count; /* Maximal mount count */
__le16 s_magic; /* Magic signature */
__le16 s_state; /* File system state */
__le16 s_errors; /* Behaviour when detecting errors */
__le16 s_minor_rev_level; /* minor revision level */
/*40*/ __le32 s_lastcheck; /* time of last check */
__le32 s_checkinterval; /* max. time between checks */
__le32 s_creator_os; /* OS */
__le32 s_rev_level; /* Revision level */
/*50*/ __le16 s_def_resuid; /* Default uid for reserved blocks */
__le16 s_def_resgid; /* Default gid for reserved blocks */
/*
* These fields are for EXT3_DYNAMIC_REV superblocks only.
*
......@@ -402,16 +402,16 @@ struct ext3_super_block {
* feature set, it must abort and not try to meddle with
* things it doesn't understand...
*/
__u32 s_first_ino; /* First non-reserved inode */
__u16 s_inode_size; /* size of inode structure */
__u16 s_block_group_nr; /* block group # of this superblock */
__u32 s_feature_compat; /* compatible feature set */
/*60*/ __u32 s_feature_incompat; /* incompatible feature set */
__u32 s_feature_ro_compat; /* readonly-compatible feature set */
__le32 s_first_ino; /* First non-reserved inode */
__le16 s_inode_size; /* size of inode structure */
__le16 s_block_group_nr; /* block group # of this superblock */
__le32 s_feature_compat; /* compatible feature set */
/*60*/ __le32 s_feature_incompat; /* incompatible feature set */
__le32 s_feature_ro_compat; /* readonly-compatible feature set */
/*68*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */
/*78*/ char s_volume_name[16]; /* volume name */
/*88*/ char s_last_mounted[64]; /* directory where last mounted */
/*C8*/ __u32 s_algorithm_usage_bitmap; /* For compression */
/*C8*/ __le32 s_algorithm_usage_bitmap; /* For compression */
/*
* Performance hints. Directory preallocation should only
* happen if the EXT3_FEATURE_COMPAT_DIR_PREALLOC flag is on.
......@@ -423,15 +423,15 @@ struct ext3_super_block {
* Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
*/
/*D0*/ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
/*E0*/ __u32 s_journal_inum; /* inode number of journal file */
__u32 s_journal_dev; /* device number of journal file */
__u32 s_last_orphan; /* start of list of inodes to delete */
__u32 s_hash_seed[4]; /* HTREE hash seed */
/*E0*/ __le32 s_journal_inum; /* inode number of journal file */
__le32 s_journal_dev; /* device number of journal file */
__le32 s_last_orphan; /* start of list of inodes to delete */
__le32 s_hash_seed[4]; /* HTREE hash seed */
__u8 s_def_hash_version; /* Default hash version to use */
__u8 s_reserved_char_pad;
__u16 s_reserved_word_pad;
__u32 s_default_mount_opts;
__u32 s_first_meta_bg; /* First metablock block group */
__le32 s_default_mount_opts;
__le32 s_first_meta_bg; /* First metablock block group */
__u32 s_reserved[190]; /* Padding to the end of the block */
};
......@@ -546,9 +546,9 @@ static inline struct ext3_inode_info *EXT3_I(struct inode *inode)
#define EXT3_NAME_LEN 255
struct ext3_dir_entry {
__u32 inode; /* Inode number */
__u16 rec_len; /* Directory entry length */
__u16 name_len; /* Name length */
__le32 inode; /* Inode number */
__le16 rec_len; /* Directory entry length */
__le16 name_len; /* Name length */
char name[EXT3_NAME_LEN]; /* File name */
};
......@@ -559,8 +559,8 @@ struct ext3_dir_entry {
* file_type field.
*/
struct ext3_dir_entry_2 {
__u32 inode; /* Inode number */
__u16 rec_len; /* Directory entry length */
__le32 inode; /* Inode number */
__le16 rec_len; /* Directory entry length */
__u8 name_len; /* Name length */
__u8 file_type;
char name[EXT3_NAME_LEN]; /* File name */
......
......@@ -22,7 +22,7 @@
* second extended file system inode data in memory
*/
struct ext3_inode_info {
__u32 i_data[15];
__le32 i_data[15]; /* unconverted */
__u32 i_flags;
#ifdef EXT3_FRAGMENTS
__u32 i_faddr;
......
......@@ -137,9 +137,9 @@ typedef struct journal_s journal_t; /* Journal control structure */
*/
typedef struct journal_header_s
{
__u32 h_magic;
__u32 h_blocktype;
__u32 h_sequence;
__be32 h_magic;
__be32 h_blocktype;
__be32 h_sequence;
} journal_header_t;
......@@ -148,8 +148,8 @@ typedef struct journal_header_s
*/
typedef struct journal_block_tag_s
{
__u32 t_blocknr; /* The on-disk block number */
__u32 t_flags; /* See below */
__be32 t_blocknr; /* The on-disk block number */
__be32 t_flags; /* See below */
} journal_block_tag_t;
/*
......@@ -159,7 +159,7 @@ typedef struct journal_block_tag_s
typedef struct journal_revoke_header_s
{
journal_header_t r_header;
int r_count; /* Count of bytes used in the block */
__be32 r_count; /* Count of bytes used in the block */
} journal_revoke_header_t;
......@@ -180,35 +180,35 @@ typedef struct journal_superblock_s
/* 0x000C */
/* Static information describing the journal */
__u32 s_blocksize; /* journal device blocksize */
__u32 s_maxlen; /* total blocks in journal file */
__u32 s_first; /* first block of log information */
__be32 s_blocksize; /* journal device blocksize */
__be32 s_maxlen; /* total blocks in journal file */
__be32 s_first; /* first block of log information */
/* 0x0018 */
/* Dynamic information describing the current state of the log */
__u32 s_sequence; /* first commit ID expected in log */
__u32 s_start; /* blocknr of start of log */
__be32 s_sequence; /* first commit ID expected in log */
__be32 s_start; /* blocknr of start of log */
/* 0x0020 */
/* Error value, as set by journal_abort(). */
__s32 s_errno;
__be32 s_errno;
/* 0x0024 */
/* Remaining fields are only valid in a version-2 superblock */
__u32 s_feature_compat; /* compatible feature set */
__u32 s_feature_incompat; /* incompatible feature set */
__u32 s_feature_ro_compat; /* readonly-compatible feature set */
__be32 s_feature_compat; /* compatible feature set */
__be32 s_feature_incompat; /* incompatible feature set */
__be32 s_feature_ro_compat; /* readonly-compatible feature set */
/* 0x0030 */
__u8 s_uuid[16]; /* 128-bit uuid for journal */
/* 0x0040 */
__u32 s_nr_users; /* Nr of filesystems sharing log */
__be32 s_nr_users; /* Nr of filesystems sharing log */
__u32 s_dynsuper; /* Blocknr of dynamic superblock copy*/
__be32 s_dynsuper; /* Blocknr of dynamic superblock copy*/
/* 0x0048 */
__u32 s_max_transaction; /* Limit of journal blocks per trans.*/
__u32 s_max_trans_data; /* Limit of data blocks per trans. */
__be32 s_max_transaction; /* Limit of journal blocks per trans.*/
__be32 s_max_trans_data; /* Limit of data blocks per trans. */
/* 0x0050 */
__u32 s_padding[44];
......
......@@ -123,34 +123,34 @@ struct fat_boot_sector {
partition manager volumes */
__u8 sector_size[2]; /* bytes per logical sector */
__u8 sec_per_clus; /* sectors/cluster */
__u16 reserved; /* reserved sectors */
__le16 reserved; /* reserved sectors */
__u8 fats; /* number of FATs */
__u8 dir_entries[2]; /* root directory entries */
__u8 sectors[2]; /* number of sectors */
__u8 media; /* media code */
__u16 fat_length; /* sectors/FAT */
__u16 secs_track; /* sectors per track */
__u16 heads; /* number of heads */
__u32 hidden; /* hidden sectors (unused) */
__u32 total_sect; /* number of sectors (if sectors == 0) */
__le16 fat_length; /* sectors/FAT */
__le16 secs_track; /* sectors per track */
__le16 heads; /* number of heads */
__le32 hidden; /* hidden sectors (unused) */
__le32 total_sect; /* number of sectors (if sectors == 0) */
/* The following fields are only used by FAT32 */
__u32 fat32_length; /* sectors/FAT */
__u16 flags; /* bit 8: fat mirroring, low 4: active fat */
__le32 fat32_length; /* sectors/FAT */
__le16 flags; /* bit 8: fat mirroring, low 4: active fat */
__u8 version[2]; /* major, minor filesystem version */
__u32 root_cluster; /* first cluster in root directory */
__u16 info_sector; /* filesystem info sector */
__u16 backup_boot; /* backup boot sector */
__u16 reserved2[6]; /* Unused */
__le32 root_cluster; /* first cluster in root directory */
__le16 info_sector; /* filesystem info sector */
__le16 backup_boot; /* backup boot sector */
__le16 reserved2[6]; /* Unused */
};
struct fat_boot_fsinfo {
__u32 signature1; /* 0x41615252L */
__u32 reserved1[120]; /* Nothing as far as I can tell */
__u32 signature2; /* 0x61417272L */
__u32 free_clusters; /* Free cluster count. -1 if unknown */
__u32 next_cluster; /* Most recently allocated cluster */
__u32 reserved2[4];
__le32 signature1; /* 0x41615252L */
__le32 reserved1[120]; /* Nothing as far as I can tell */
__le32 signature2; /* 0x61417272L */
__le32 free_clusters; /* Free cluster count. -1 if unknown */
__le32 next_cluster; /* Most recently allocated cluster */
__le32 reserved2[4];
};
struct msdos_dir_entry {
......@@ -158,12 +158,12 @@ struct msdos_dir_entry {
__u8 attr; /* attribute bits */
__u8 lcase; /* Case for base and extension */
__u8 ctime_ms; /* Creation time, milliseconds */
__u16 ctime; /* Creation time */
__u16 cdate; /* Creation date */
__u16 adate; /* Last access date */
__u16 starthi; /* High 16 bits of cluster in FAT32 */
__u16 time,date,start;/* time, date and first cluster */
__u32 size; /* file size (in bytes) */
__le16 ctime; /* Creation time */
__le16 cdate; /* Creation date */
__le16 adate; /* Last access date */
__le16 starthi; /* High 16 bits of cluster in FAT32 */
__le16 time,date,start;/* time, date and first cluster */
__le32 size; /* file size (in bytes) */
};
/* Up to 13 characters of the name */
......@@ -174,7 +174,7 @@ struct msdos_dir_slot {
__u8 reserved; /* always 0 */
__u8 alias_checksum; /* checksum for 8.3 alias */
__u8 name5_10[12]; /* 6 more characters in name */
__u16 start; /* starting cluster number, 0 in long slots */
__le16 start; /* starting cluster number, 0 in long slots */
__u8 name11_12[4]; /* last 2 characters in name */
};
......@@ -287,8 +287,7 @@ extern void fat_clusters_flush(struct super_block *sb);
extern int fat_add_cluster(struct inode *inode);
extern struct buffer_head *fat_extend_dir(struct inode *inode);
extern int date_dos2unix(unsigned short time, unsigned short date);
extern void fat_date_unix2dos(int unix_date, unsigned short *time,
unsigned short *date);
extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date);
extern int fat__get_entry(struct inode *dir, loff_t *pos,
struct buffer_head **bh,
struct msdos_dir_entry **de, loff_t *i_pos);
......
This diff is collapsed.
......@@ -67,8 +67,8 @@ struct rxrpc_call
wait_queue_head_t waitq; /* wait queue for events to happen */
struct list_head link; /* general internal list link */
struct list_head call_link; /* master call list link */
uint32_t chan_ix; /* connection channel index (net order) */
uint32_t call_id; /* call ID on connection (net order) */
__be32 chan_ix; /* connection channel index */
__be32 call_id; /* call ID on connection */
unsigned long cjif; /* jiffies at call creation */
unsigned long flags; /* control flags */
#define RXRPC_CALL_ACKS_TIMO 0x00000001 /* ACKS timeout reached */
......@@ -97,7 +97,7 @@ struct rxrpc_call
rxrpc_seq_t ackr_win_bot; /* bottom of ACK window */
rxrpc_seq_t ackr_win_top; /* top of ACK window */
rxrpc_seq_t ackr_high_seq; /* highest seqno yet received */
rxrpc_seq_t ackr_prev_seq; /* previous seqno received */
rxrpc_seq_net_t ackr_prev_seq; /* previous seqno received */
unsigned ackr_pend_cnt; /* number of pending ACKs */
struct timer_list ackr_dfr_timo; /* timeout on deferred ACK */
char ackr_dfr_perm; /* request for deferred ACKs permitted */
......
......@@ -45,18 +45,18 @@ struct rxrpc_connection
rxrpc_serial_t serial_counter; /* packet serial number counter */
/* the following should all be in net order */
uint32_t in_epoch; /* peer's epoch */
uint32_t out_epoch; /* my epoch */
uint32_t conn_id; /* connection ID, appropriately shifted */
uint16_t service_id; /* service ID */
__be32 in_epoch; /* peer's epoch */
__be32 out_epoch; /* my epoch */
__be32 conn_id; /* connection ID, appropriately shifted */
__be16 service_id; /* service ID */
uint8_t security_ix; /* security ID */
uint8_t in_clientflag; /* RXRPC_CLIENT_INITIATED if we are server */
uint8_t out_clientflag; /* RXRPC_CLIENT_INITIATED if we are client */
};
extern int rxrpc_create_connection(struct rxrpc_transport *trans,
uint16_t port,
uint32_t addr,
__be16 port,
__be32 addr,
uint16_t service_id,
void *security,
struct rxrpc_connection **_conn);
......
......@@ -27,19 +27,19 @@ extern size_t RXRPC_MAX_PACKET_SIZE;
*/
struct rxrpc_header
{
uint32_t epoch; /* client boot timestamp */
__be32 epoch; /* client boot timestamp */
uint32_t cid; /* connection and channel ID */
__be32 cid; /* connection and channel ID */
#define RXRPC_MAXCALLS 4 /* max active calls per conn */
#define RXRPC_CHANNELMASK (RXRPC_MAXCALLS-1) /* mask for channel ID */
#define RXRPC_CIDMASK (~RXRPC_CHANNELMASK) /* mask for connection ID */
#define RXRPC_CIDSHIFT 2 /* shift for connection ID */
uint32_t callNumber; /* call ID (0 for connection-level packets) */
__be32 callNumber; /* call ID (0 for connection-level packets) */
#define RXRPC_PROCESS_MAXCALLS (1<<2) /* maximum number of active calls per conn (power of 2) */
uint32_t seq; /* sequence number of pkt in call stream */
uint32_t serial; /* serial number of pkt sent to network */
__be32 seq; /* sequence number of pkt in call stream */
__be32 serial; /* serial number of pkt sent to network */
uint8_t type; /* packet type */
#define RXRPC_PACKET_TYPE_DATA 1 /* data */
......@@ -62,8 +62,8 @@ struct rxrpc_header
uint8_t userStatus; /* app-layer defined status */
uint8_t securityIndex; /* security protocol ID */
uint16_t _rsvd; /* reserved (used by kerberos security as cksum) */
uint16_t serviceId; /* service ID */
__be16 _rsvd; /* reserved (used by kerberos security as cksum) */
__be16 serviceId; /* service ID */
} __attribute__((packed));
......@@ -85,7 +85,7 @@ struct rxrpc_jumbo_header
{
uint8_t flags; /* packet flags (as per rxrpc_header) */
uint8_t pad;
uint16_t _rsvd; /* reserved (used by kerberos security as cksum) */
__be16 _rsvd; /* reserved (used by kerberos security as cksum) */
};
#define RXRPC_JUMBO_DATALEN 1412 /* non-terminal jumbo packet data length */
......@@ -97,12 +97,12 @@ struct rxrpc_jumbo_header
*/
struct rxrpc_ackpacket
{
uint16_t bufferSpace; /* number of packet buffers available */
uint16_t maxSkew; /* diff between serno being ACK'd and highest serial no
__be16 bufferSpace; /* number of packet buffers available */
__be16 maxSkew; /* diff between serno being ACK'd and highest serial no
* received */
uint32_t firstPacket; /* sequence no of first ACK'd packet in attached list */
uint32_t previousPacket; /* sequence no of previous packet received */
uint32_t serial; /* serial no of packet that prompted this ACK */
__be32 firstPacket; /* sequence no of first ACK'd packet in attached list */
__be32 previousPacket; /* sequence no of previous packet received */
__be32 serial; /* serial no of packet that prompted this ACK */
uint8_t reason; /* reason for ACK */
#define RXRPC_ACK_REQUESTED 1 /* ACK was requested on packet */
......
......@@ -67,7 +67,7 @@ struct rxrpc_peer
extern int rxrpc_peer_lookup(struct rxrpc_transport *trans,
u32 addr,
__be32 addr,
struct rxrpc_peer **_peer);
static inline void rxrpc_get_peer(struct rxrpc_peer *peer)
......
......@@ -14,7 +14,7 @@
#ifdef __KERNEL__
extern uint32_t rxrpc_epoch;
extern __be32 rxrpc_epoch;
#ifdef CONFIG_SYSCTL
extern int rxrpc_ktrace;
......
......@@ -21,6 +21,8 @@
typedef uint32_t rxrpc_seq_t; /* Rx message sequence number */
typedef uint32_t rxrpc_serial_t; /* Rx message serial number */
typedef __be32 rxrpc_seq_net_t; /* on-the-wire Rx message sequence number */
typedef __be32 rxrpc_serial_net_t; /* on-the-wire Rx message serial number */
struct rxrpc_call;
struct rxrpc_connection;
......
......@@ -472,7 +472,7 @@ static inline int __rxrpc_call_gen_normal_ACK(struct rxrpc_call *call,
{
struct rxrpc_message *msg;
struct kvec diov[3];
unsigned aux[4];
__be32 aux[4];
int delta, ret;
/* ACKs default to DELAY */
......@@ -840,7 +840,7 @@ static int __rxrpc_call_abort(struct rxrpc_call *call, int errno)
struct rxrpc_message *msg;
struct kvec diov[1];
int ret;
u32 _error;
__be32 _error;
_enter("%p{%08x},%p{%d},%d",
conn, ntohl(conn->conn_id), call, ntohl(call->call_id), errno);
......@@ -986,7 +986,7 @@ static void rxrpc_call_receive_packet(struct rxrpc_call *call)
/* deal with abort packets */
case RXRPC_PACKET_TYPE_ABORT: {
uint32_t _dbuf, *dp;
__be32 _dbuf, *dp;
dp = skb_header_pointer(msg->pkt, msg->offset,
sizeof(_dbuf), &_dbuf);
......@@ -1048,7 +1048,7 @@ static void rxrpc_call_receive_data_packet(struct rxrpc_call *call,
struct rxrpc_message *pmsg;
struct list_head *_p;
int ret, lo, hi, rmtimo;
u32 opid;
__be32 opid;
_enter("%p{%u},%p{%u}", call, ntohl(call->call_id), msg, msg->seq);
......@@ -1270,7 +1270,7 @@ static void rxrpc_call_receive_ack_packet(struct rxrpc_call *call,
struct rxrpc_message *msg)
{
struct rxrpc_ackpacket _ack, *ap;
rxrpc_serial_t serial;
rxrpc_serial_net_t serial;
rxrpc_seq_t seq;
int ret;
......
......@@ -88,8 +88,8 @@ static inline int __rxrpc_create_connection(struct rxrpc_peer *peer,
* create a new connection record for outgoing connections
*/
int rxrpc_create_connection(struct rxrpc_transport *trans,
uint16_t port,
uint32_t addr,
__be16 port,
__be32 addr,
uint16_t service_id,
void *security,
struct rxrpc_connection **_conn)
......@@ -97,7 +97,7 @@ int rxrpc_create_connection(struct rxrpc_transport *trans,
struct rxrpc_connection *candidate, *conn;
struct rxrpc_peer *peer;
struct list_head *_p;
uint32_t connid;
__be32 connid;
int ret;
_enter("%p{%hu},%u,%hu", trans, trans->port, ntohs(port), service_id);
......@@ -169,7 +169,7 @@ int rxrpc_create_connection(struct rxrpc_transport *trans,
spin_unlock(&peer->conn_gylock);
/* pick the new candidate */
_debug("created connection: {%08x} [out]", htonl(candidate->conn_id));
_debug("created connection: {%08x} [out]", ntohl(candidate->conn_id));
atomic_inc(&peer->conn_count);
conn = candidate;
candidate = NULL;
......@@ -199,7 +199,7 @@ int rxrpc_create_connection(struct rxrpc_transport *trans,
/* handle resurrecting a connection from the graveyard */
found_in_graveyard:
_debug("resurrecting connection: {%08x} [out]", htonl(conn->conn_id));
_debug("resurrecting connection: {%08x} [out]", ntohl(conn->conn_id));
rxrpc_get_connection(conn);
rxrpc_krxtimod_del_timer(&conn->timeout);
list_del_init(&conn->link);
......@@ -219,8 +219,9 @@ int rxrpc_connection_lookup(struct rxrpc_peer *peer,
struct rxrpc_connection *conn, *candidate = NULL;
struct list_head *_p;
int ret, fresh = 0;
u32 x_epoch, x_connid;
u16 x_port, x_secix, x_servid;
__be32 x_epoch, x_connid;
__be16 x_port, x_servid;
__u32 x_secix;
u8 x_clflag;
_enter("%p{{%hu}},%u,%hu",
......@@ -310,7 +311,7 @@ int rxrpc_connection_lookup(struct rxrpc_peer *peer,
}
/* we can now add the new candidate to the list */
_debug("created connection: {%08x} [in]", htonl(candidate->conn_id));
_debug("created connection: {%08x} [in]", ntohl(candidate->conn_id));
rxrpc_get_peer(peer);
conn = candidate;
candidate = NULL;
......@@ -351,7 +352,7 @@ int rxrpc_connection_lookup(struct rxrpc_peer *peer,
/* handle resurrecting a connection from the graveyard */
found_in_graveyard:
_debug("resurrecting connection: {%08x} [in]", htonl(conn->conn_id));
_debug("resurrecting connection: {%08x} [in]", ntohl(conn->conn_id));
rxrpc_get_peer(peer);
rxrpc_get_connection(conn);
rxrpc_krxtimod_del_timer(&conn->timeout);
......@@ -397,7 +398,7 @@ void rxrpc_put_connection(struct rxrpc_connection *conn)
}
/* move to graveyard queue */
_debug("burying connection: {%08x}", htonl(conn->conn_id));
_debug("burying connection: {%08x}", ntohl(conn->conn_id));
list_del(&conn->link);
list_add_tail(&conn->link, &peer->conn_graveyard);
......@@ -442,7 +443,7 @@ void rxrpc_conn_do_timeout(struct rxrpc_connection *conn)
}
_debug("--- Destroying Connection %p{%08x} ---",
conn, htonl(conn->conn_id));
conn, ntohl(conn->conn_id));
down_write(&rxrpc_conns_sem);
list_del(&conn->proc_link);
......@@ -640,8 +641,8 @@ int rxrpc_conn_sendmsg(struct rxrpc_connection *conn,
_net("Sending message type %d of %Zd bytes to %08x:%d",
msg->hdr.type,
msg->dsize,
htonl(conn->addr.sin_addr.s_addr),
htons(conn->addr.sin_port));
ntohl(conn->addr.sin_addr.s_addr),
ntohs(conn->addr.sin_port));
/* send the message */
ret = kernel_sendmsg(conn->trans->socket, &msghdr,
......@@ -699,11 +700,11 @@ int rxrpc_conn_receive_call_packet(struct rxrpc_connection *conn,
}
_proto("Received packet %%%u [%u] on call %hu:%u:%u",
htonl(msg->hdr.serial),
htonl(msg->hdr.seq),
htons(msg->hdr.serviceId),
htonl(conn->conn_id),
htonl(call->call_id));
ntohl(msg->hdr.serial),
ntohl(msg->hdr.seq),
ntohs(msg->hdr.serviceId),
ntohl(conn->conn_id),
ntohl(call->call_id));
call->pkt_rcv_count++;
......
......@@ -32,7 +32,7 @@ MODULE_DESCRIPTION("Rx RPC implementation");
MODULE_AUTHOR("Red Hat, Inc.");
MODULE_LICENSE("GPL");
uint32_t rxrpc_epoch;
__be32 rxrpc_epoch;
/*****************************************************************************/
/*
......
......@@ -48,7 +48,7 @@ static const struct rxrpc_timer_ops rxrpc_peer_timer_ops = {
/*
* create a peer record
*/
static int __rxrpc_create_peer(struct rxrpc_transport *trans, uint32_t addr,
static int __rxrpc_create_peer(struct rxrpc_transport *trans, __be32 addr,
struct rxrpc_peer **_peer)
{
struct rxrpc_peer *peer;
......@@ -96,7 +96,7 @@ static int __rxrpc_create_peer(struct rxrpc_transport *trans, uint32_t addr,
* - returns (if successful) with peer record usage incremented
* - resurrects it from the graveyard if found there
*/
int rxrpc_peer_lookup(struct rxrpc_transport *trans, uint32_t addr,
int rxrpc_peer_lookup(struct rxrpc_transport *trans, __be32 addr,
struct rxrpc_peer **_peer)
{
struct rxrpc_peer *peer, *candidate = NULL;
......
......@@ -457,8 +457,8 @@ void rxrpc_trans_receive_packet(struct rxrpc_transport *trans)
struct rxrpc_peer *peer;
struct sk_buff *pkt;
int ret;
u32 addr;
u16 port;
__be32 addr;
__be16 port;
LIST_HEAD(msgq);
......@@ -612,7 +612,7 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
struct sockaddr_in sin;
struct msghdr msghdr;
struct kvec iov[2];
uint32_t _error;
__be32 _error;
int len, ret;
_enter("%p,%p,%d", trans, msg, error);
......@@ -655,8 +655,8 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
_net("Sending message type %d of %d bytes to %08x:%d",
ahdr.type,
len,
htonl(sin.sin_addr.s_addr),
htons(sin.sin_port));
ntohl(sin.sin_addr.s_addr),
ntohs(sin.sin_port));
/* send the message */
ret = kernel_sendmsg(trans->socket, &msghdr, iov, 2, len);
......@@ -678,7 +678,7 @@ static void rxrpc_trans_receive_error_report(struct rxrpc_transport *trans)
struct list_head connq, *_p;
struct errormsg emsg;
struct msghdr msg;
uint16_t port;
__be16 port;
int local, err;
_enter("%p", trans);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment