[PATCH 8/9] ext2fs: fix type of blockaddr
* ext2fs/dir.c (diskfs_lookup_hard): Use vm_address_t for blockaddr. --- ext2fs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext2fs/dir.c b/ext2fs/dir.c index 1f7c7ed..ad55681 100644 --- a/ext2fs/dir.c +++ b/ext2fs/dir.c @@ -146,7 +146,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type, memory_object_t memobj; vm_address_t buf = 0; vm_size_t buflen = 0; - int blockaddr; + vm_address_t blockaddr; int idx, lastidx; int looped; -- 2.0.0.rc2
[PATCH 2/9] hurd: fix type of optimal_transfer_size
* hurd/shared.h (struct shared_io): Use blksize_t for optimal_transfer_size. --- hurd/shared.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hurd/shared.h b/hurd/shared.h index 6f13637..25747eb 100644 --- a/hurd/shared.h +++ b/hurd/shared.h @@ -66,7 +66,7 @@ struct shared_io int use_read_size; /* read_size is meaningful */ off_t read_size; - size_t optimal_transfer_size;/* users should try to have the + blksize_t optimal_transfer_size; /* users should try to have the arguments to io_prenotify, etc. be multiples of this value if it is nonzero. */ -- 2.0.0.rc2
[PATCH 4/9] libdiskfs: avoid implicit integer conversion
* libdiskfs/boot-start.c (diskfs_boot_start): Avoid implicit integer conversion. --- libdiskfs/boot-start.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libdiskfs/boot-start.c b/libdiskfs/boot-start.c index a60a1d0..4cc7bb8 100644 --- a/libdiskfs/boot-start.c +++ b/libdiskfs/boot-start.c @@ -217,8 +217,9 @@ diskfs_start_bootstrap () while (*initname == '/') initname++; - exec_argvlen = asprintf (&exec_argv, "/%s%c", initname, '\0'); - assert (exec_argvlen != -1); + int len = asprintf (&exec_argv, "/%s%c", initname, '\0'); + assert (len != -1); + exec_argvlen = (size_t) len; err = argz_add_sep (&exec_argv, &exec_argvlen, diskfs_boot_command_line, ' '); assert_perror (err); -- 2.0.0.rc2
[PATCH 5/9] ext2fs: fix compiler warning
* ext2fs/pager.c (disk_cache_block_ref): block cannot be negative. --- ext2fs/pager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext2fs/pager.c b/ext2fs/pager.c index ce5bc6d..39cf1c7 100644 --- a/ext2fs/pager.c +++ b/ext2fs/pager.c @@ -957,7 +957,7 @@ disk_cache_block_ref (block_t block) int index; void *bptr; - assert (0 <= block && block < store->size >> log2_block_size); + assert (block < store->size >> log2_block_size); ext2_debug ("(%u)", block); -- 2.0.0.rc2
[PATCH 6/9] ext2fs: use correct type for disk offsets
* ext2fs/dir.c (count_dirents): Use off_t for nb. (diskfs_get_directs): Likewise for blkno, nblks. --- ext2fs/dir.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext2fs/dir.c b/ext2fs/dir.c index a7eeaaa..0597500 100644 --- a/ext2fs/dir.c +++ b/ext2fs/dir.c @@ -823,7 +823,7 @@ diskfs_drop_dirstat (struct node *dp, struct dirstat *ds) write the answer down in its dirents array. As a side affect fill BUF with the block. */ static error_t -count_dirents (struct node *dp, int nb, char *buf) +count_dirents (struct node *dp, off_t nb, char *buf) { size_t amt; char *offinblk; @@ -868,8 +868,8 @@ diskfs_get_directs (struct node *dp, vm_size_t bufsiz, int *amt) { - int blkno; - int nblks; + off_t blkno; + off_t nblks; int curentry; char buf[DIRBLKSIZ]; char *bufp; -- 2.0.0.rc2
[PATCH 1/9] include: use unsigned literal in combination with binary not
* include/refcount.h (refcounts_promote): Use ~0U. (refcounts_demote): Likewise. --- include/refcount.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/refcount.h b/include/refcount.h index 5c3302d..785b052 100644 --- a/include/refcount.h +++ b/include/refcount.h @@ -160,7 +160,7 @@ refcounts_promote (refcounts_t *ref, struct references *result) So we just add a hard reference. In combination, this is the desired operation. */ const union _references op = -{ .references = { .weak = ~0, .hard = 1} }; +{ .references = { .weak = ~0U, .hard = 1} }; union _references r; r.value = __atomic_add_fetch (&ref->value, op.value, __ATOMIC_RELAXED); assert (r.references.hard != UINT32_MAX || !"refcount overflowed!"); @@ -188,7 +188,7 @@ refcounts_demote (refcounts_t *ref, struct references *result) significant bits. When we add ~0 to the hard references, it will overflow into the weak references. This is the desired operation. */ - const union _references op = { .references = { .hard = ~0 } }; + const union _references op = { .references = { .hard = ~0U } }; union _references r; r.value = __atomic_add_fetch (&ref->value, op.value, __ATOMIC_RELAXED); assert (r.references.hard != UINT32_MAX || !"refcount underflowed!"); -- 2.0.0.rc2
[PATCH 7/9] ext2fs: use size_t where appropriate
* extfs/dir.c: Use size_t where appropriate. --- ext2fs/dir.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ext2fs/dir.c b/ext2fs/dir.c index 0597500..1f7c7ed 100644 --- a/ext2fs/dir.c +++ b/ext2fs/dir.c @@ -99,7 +99,7 @@ diskfs_null_dirstat (struct dirstat *ds) static error_t dirscanblock (vm_address_t blockoff, struct node *dp, int idx, - const char *name, int namelen, enum lookup_type type, + const char *name, size_t namelen, enum lookup_type type, struct dirstat *ds, ino_t *inum); @@ -137,7 +137,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type, { error_t err; ino_t inum; - int namelen; + size_t namelen; int spec_dotdot; struct node *np = 0; int retry_dotdot = 0; @@ -379,11 +379,11 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type, return ENOENT. */ static error_t dirscanblock (vm_address_t blockaddr, struct node *dp, int idx, - const char *name, int namelen, enum lookup_type type, + const char *name, size_t namelen, enum lookup_type type, struct dirstat *ds, ino_t *inum) { - int nfree = 0; - int needed = 0; + size_t nfree = 0; + size_t needed = 0; vm_address_t currentoff, prevoff; struct ext2_dir_entry_2 *entry = 0; int nentries = 0; @@ -421,7 +421,7 @@ dirscanblock (vm_address_t blockaddr, struct node *dp, int idx, if (looking || countcopies) { - int thisfree; + size_t thisfree; /* Count how much free space this entry has in it. */ if (entry->inode == 0) @@ -527,11 +527,11 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np, struct dirstat *ds, struct protid *cred) { struct ext2_dir_entry_2 *new; - int namelen = strlen (name); - int needed = EXT2_DIR_REC_LEN (namelen); - int oldneeded; + size_t namelen = strlen (name); + size_t needed = EXT2_DIR_REC_LEN (namelen); + size_t oldneeded; vm_address_t fromoff, tooff; - int totfreed; + size_t totfreed; error_t err; size_t oldsize = 0; @@ -577,7 +577,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np, { struct ext2_dir_entry_2 *from = (struct ext2_dir_entry_2 *)fromoff; struct ext2_dir_entry_2 *to = (struct ext2_dir_entry_2 *) tooff; - int fromreclen = from->rec_len; + size_t fromreclen = from->rec_len; if (from->inode != 0) { -- 2.0.0.rc2
[PATCH 9/9] ext2fs: fix type of retry_dotdot
* ext2fs/dir.c (diskfs_lookup_hard): Use ino_t for retry_dotdot. --- ext2fs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext2fs/dir.c b/ext2fs/dir.c index ad55681..46a22a1 100644 --- a/ext2fs/dir.c +++ b/ext2fs/dir.c @@ -140,7 +140,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type, size_t namelen; int spec_dotdot; struct node *np = 0; - int retry_dotdot = 0; + ino_t retry_dotdot = 0; vm_prot_t prot = (type == LOOKUP) ? VM_PROT_READ : (VM_PROT_READ | VM_PROT_WRITE); memory_object_t memobj; -- 2.0.0.rc2
[PATCH 3/9] libdiskfs: use correct type for disk offsets
* libdiskfs/diskfs.h (struct peropen): Use off_t for filepointer. --- libdiskfs/diskfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h index 2c68aa3..e328527 100644 --- a/libdiskfs/diskfs.h +++ b/libdiskfs/diskfs.h @@ -56,7 +56,7 @@ struct protid /* One of these is created for each node opened by dir_lookup. */ struct peropen { - int filepointer; + off_t filepointer; int lock_status; refcount_t refcnt; int openstat; -- 2.0.0.rc2
Re: [PATCH 1/9] include: use unsigned literal in combination with binary not
Justus Winter, le Fri 06 Jun 2014 16:42:10 +0200, a écrit : > * include/refcount.h (refcounts_promote): Use ~0U. > (refcounts_demote): Likewise. Ack. > --- > include/refcount.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/refcount.h b/include/refcount.h > index 5c3302d..785b052 100644 > --- a/include/refcount.h > +++ b/include/refcount.h > @@ -160,7 +160,7 @@ refcounts_promote (refcounts_t *ref, struct references > *result) > So we just add a hard reference. In combination, this is the > desired operation. */ >const union _references op = > -{ .references = { .weak = ~0, .hard = 1} }; > +{ .references = { .weak = ~0U, .hard = 1} }; >union _references r; >r.value = __atomic_add_fetch (&ref->value, op.value, __ATOMIC_RELAXED); >assert (r.references.hard != UINT32_MAX || !"refcount overflowed!"); > @@ -188,7 +188,7 @@ refcounts_demote (refcounts_t *ref, struct references > *result) > significant bits. When we add ~0 to the hard references, it will > overflow into the weak references. This is the desired > operation. */ > - const union _references op = { .references = { .hard = ~0 } }; > + const union _references op = { .references = { .hard = ~0U } }; >union _references r; >r.value = __atomic_add_fetch (&ref->value, op.value, __ATOMIC_RELAXED); >assert (r.references.hard != UINT32_MAX || !"refcount underflowed!"); > -- > 2.0.0.rc2 > -- Samuel > Quelqu'un aurait-il une solution pour réinitialiser un MBR Si tu veux qu'il soit complètement blanc (pas souhaitable, à mon avis) : dd if=/dev/zero of=/dev/hda bs=512 count=1 (sous Linux) -+- OT in Guide du linuxien (très) pervers - "Pour les K difficiles" -+-
Re: [PATCH 2/9] hurd: fix type of optimal_transfer_size
Justus Winter, le Fri 06 Jun 2014 16:42:11 +0200, a écrit : > * hurd/shared.h (struct shared_io): Use blksize_t for optimal_transfer_size. Ack. > --- > hurd/shared.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hurd/shared.h b/hurd/shared.h > index 6f13637..25747eb 100644 > --- a/hurd/shared.h > +++ b/hurd/shared.h > @@ -66,7 +66,7 @@ struct shared_io >int use_read_size; /* read_size is meaningful */ >off_t read_size; > > - size_t optimal_transfer_size; /* users should try to have the > + blksize_t optimal_transfer_size; /* users should try to have the > arguments to io_prenotify, etc. be > multiples of this value if it is > nonzero. */ > -- > 2.0.0.rc2 > -- Samuel «Tiens, quand j'aurai un peu de temps et une partition libre, je crois que je vais essayer de remplacer mes scripts de démarrage par des programmes Windows lancés via Wine et binfmt_misc :-)» -+- AGV in Guide du linuxien pervers - "J'sais pas quoi faire... (air connu)"
Re: [PATCH 3/9] libdiskfs: use correct type for disk offsets
Justus Winter, le Fri 06 Jun 2014 16:42:12 +0200, a écrit : > * libdiskfs/diskfs.h (struct peropen): Use off_t for filepointer. Ack. > --- > libdiskfs/diskfs.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h > index 2c68aa3..e328527 100644 > --- a/libdiskfs/diskfs.h > +++ b/libdiskfs/diskfs.h > @@ -56,7 +56,7 @@ struct protid > /* One of these is created for each node opened by dir_lookup. */ > struct peropen > { > - int filepointer; > + off_t filepointer; >int lock_status; >refcount_t refcnt; >int openstat; > -- > 2.0.0.rc2 > -- Samuel I develop for Linux for a living, I used to develop for DOS. Going from DOS to Linux is like trading a glider for an F117. (By entr...@world.std.com, Lawrence Foard)
Re: [PATCH 4/9] libdiskfs: avoid implicit integer conversion
Justus Winter, le Fri 06 Jun 2014 16:42:13 +0200, a écrit : > * libdiskfs/boot-start.c (diskfs_boot_start): Avoid implicit integer > conversion. Ack. > --- > libdiskfs/boot-start.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/libdiskfs/boot-start.c b/libdiskfs/boot-start.c > index a60a1d0..4cc7bb8 100644 > --- a/libdiskfs/boot-start.c > +++ b/libdiskfs/boot-start.c > @@ -217,8 +217,9 @@ diskfs_start_bootstrap () >while (*initname == '/') > initname++; > > - exec_argvlen = asprintf (&exec_argv, "/%s%c", initname, '\0'); > - assert (exec_argvlen != -1); > + int len = asprintf (&exec_argv, "/%s%c", initname, '\0'); > + assert (len != -1); > + exec_argvlen = (size_t) len; >err = argz_add_sep (&exec_argv, &exec_argvlen, > diskfs_boot_command_line, ' '); >assert_perror (err); > -- > 2.0.0.rc2 > -- Samuel FYLG> Tiens, vlà une URL qui va bien : FYLG> ftp://127.0.0.1/WaReZ/NiouZeS/WinDoZe/NeWSMoNGeR/SuPeR c'est gentil sauf que l'adresse ne fonctionne pas sa me fais une erreur -+- Furtif in Guide du Neuneu Usenet : -+-
Re: [PATCH 5/9] ext2fs: fix compiler warning
Justus Winter, le Fri 06 Jun 2014 16:42:14 +0200, a écrit : > * ext2fs/pager.c (disk_cache_block_ref): block cannot be negative. Ack. > --- > ext2fs/pager.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/ext2fs/pager.c b/ext2fs/pager.c > index ce5bc6d..39cf1c7 100644 > --- a/ext2fs/pager.c > +++ b/ext2fs/pager.c > @@ -957,7 +957,7 @@ disk_cache_block_ref (block_t block) >int index; >void *bptr; > > - assert (0 <= block && block < store->size >> log2_block_size); > + assert (block < store->size >> log2_block_size); > >ext2_debug ("(%u)", block); > > -- > 2.0.0.rc2 > -- Samuel KK1 a 1 conseil de comment s'attaquer a du code java ou ya plus de 50 classes ? par kel bout ? le troisième -+- #ens-mim en stage -+-
Re: [PATCH 6/9] ext2fs: use correct type for disk offsets
Justus Winter, le Fri 06 Jun 2014 16:42:15 +0200, a écrit : > * ext2fs/dir.c (count_dirents): Use off_t for nb. > (diskfs_get_directs): Likewise for blkno, nblks. Well, it's not actually an offset, but a block number, so it would probably be a block_t actually? > --- > ext2fs/dir.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/ext2fs/dir.c b/ext2fs/dir.c > index a7eeaaa..0597500 100644 > --- a/ext2fs/dir.c > +++ b/ext2fs/dir.c > @@ -823,7 +823,7 @@ diskfs_drop_dirstat (struct node *dp, struct dirstat *ds) > write the answer down in its dirents array. As a side affect > fill BUF with the block. */ > static error_t > -count_dirents (struct node *dp, int nb, char *buf) > +count_dirents (struct node *dp, off_t nb, char *buf) > { >size_t amt; >char *offinblk; > @@ -868,8 +868,8 @@ diskfs_get_directs (struct node *dp, > vm_size_t bufsiz, > int *amt) > { > - int blkno; > - int nblks; > + off_t blkno; > + off_t nblks; >int curentry; >char buf[DIRBLKSIZ]; >char *bufp; > -- > 2.0.0.rc2 > -- Samuel As usual, this being a 1.3.x release, I haven't even compiled this kernel yet. So if it works, you should be doubly impressed. (Linus Torvalds, announcing kernel 1.3.3 on the linux-kernel mailing list.)
Re: [PATCH 8/9] ext2fs: fix type of blockaddr
Justus Winter, le Fri 06 Jun 2014 16:42:17 +0200, a écrit : > * ext2fs/dir.c (diskfs_lookup_hard): Use vm_address_t for blockaddr. Ack. > --- > ext2fs/dir.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/ext2fs/dir.c b/ext2fs/dir.c > index 1f7c7ed..ad55681 100644 > --- a/ext2fs/dir.c > +++ b/ext2fs/dir.c > @@ -146,7 +146,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, > enum lookup_type type, >memory_object_t memobj; >vm_address_t buf = 0; >vm_size_t buflen = 0; > - int blockaddr; > + vm_address_t blockaddr; >int idx, lastidx; >int looped; > > -- > 2.0.0.rc2 > -- Samuel I am the "ILOVEGNU" signature virus. Just copy me to your signature. This email was infected under the terms of the GNU General Public License.
Re: [PATCH 9/9] ext2fs: fix type of retry_dotdot
Justus Winter, le Fri 06 Jun 2014 16:42:18 +0200, a écrit : > * ext2fs/dir.c (diskfs_lookup_hard): Use ino_t for retry_dotdot. Ack. > --- > ext2fs/dir.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/ext2fs/dir.c b/ext2fs/dir.c > index ad55681..46a22a1 100644 > --- a/ext2fs/dir.c > +++ b/ext2fs/dir.c > @@ -140,7 +140,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, > enum lookup_type type, >size_t namelen; >int spec_dotdot; >struct node *np = 0; > - int retry_dotdot = 0; > + ino_t retry_dotdot = 0; >vm_prot_t prot = > (type == LOOKUP) ? VM_PROT_READ : (VM_PROT_READ | VM_PROT_WRITE); >memory_object_t memobj; > -- > 2.0.0.rc2 > -- Samuel jr> J'ai fait. Ne bougez pas, l'aide soignante va venir nettoyer. -+- FF in GNU - Le vieil homme et la merde -+-
Re: [PATCH 7/9] ext2fs: use size_t where appropriate
Justus Winter, le Fri 06 Jun 2014 16:42:16 +0200, a écrit : > * extfs/dir.c: Use size_t where appropriate. Ack. > --- > ext2fs/dir.c | 22 +++--- > 1 file changed, 11 insertions(+), 11 deletions(-) > > diff --git a/ext2fs/dir.c b/ext2fs/dir.c > index 0597500..1f7c7ed 100644 > --- a/ext2fs/dir.c > +++ b/ext2fs/dir.c > @@ -99,7 +99,7 @@ diskfs_null_dirstat (struct dirstat *ds) > > static error_t > dirscanblock (vm_address_t blockoff, struct node *dp, int idx, > - const char *name, int namelen, enum lookup_type type, > + const char *name, size_t namelen, enum lookup_type type, > struct dirstat *ds, ino_t *inum); > > > @@ -137,7 +137,7 @@ diskfs_lookup_hard (struct node *dp, const char *name, > enum lookup_type type, > { >error_t err; >ino_t inum; > - int namelen; > + size_t namelen; >int spec_dotdot; >struct node *np = 0; >int retry_dotdot = 0; > @@ -379,11 +379,11 @@ diskfs_lookup_hard (struct node *dp, const char *name, > enum lookup_type type, > return ENOENT. */ > static error_t > dirscanblock (vm_address_t blockaddr, struct node *dp, int idx, > - const char *name, int namelen, enum lookup_type type, > + const char *name, size_t namelen, enum lookup_type type, > struct dirstat *ds, ino_t *inum) > { > - int nfree = 0; > - int needed = 0; > + size_t nfree = 0; > + size_t needed = 0; >vm_address_t currentoff, prevoff; >struct ext2_dir_entry_2 *entry = 0; >int nentries = 0; > @@ -421,7 +421,7 @@ dirscanblock (vm_address_t blockaddr, struct node *dp, > int idx, > >if (looking || countcopies) > { > - int thisfree; > + size_t thisfree; > > /* Count how much free space this entry has in it. */ > if (entry->inode == 0) > @@ -527,11 +527,11 @@ diskfs_direnter_hard (struct node *dp, const char > *name, struct node *np, > struct dirstat *ds, struct protid *cred) > { >struct ext2_dir_entry_2 *new; > - int namelen = strlen (name); > - int needed = EXT2_DIR_REC_LEN (namelen); > - int oldneeded; > + size_t namelen = strlen (name); > + size_t needed = EXT2_DIR_REC_LEN (namelen); > + size_t oldneeded; >vm_address_t fromoff, tooff; > - int totfreed; > + size_t totfreed; >error_t err; >size_t oldsize = 0; > > @@ -577,7 +577,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, > struct node *np, > { > struct ext2_dir_entry_2 *from = (struct ext2_dir_entry_2 *)fromoff; > struct ext2_dir_entry_2 *to = (struct ext2_dir_entry_2 *) tooff; > - int fromreclen = from->rec_len; > + size_t fromreclen = from->rec_len; > > if (from->inode != 0) > { > -- > 2.0.0.rc2 > -- Samuel Yep. Moi j'ai un clavier à une touche. Par contre, ma souris a 102 boutons, c'est pas toujours pratique. -+- OG in: Guide du Cabaliste Usenet - Le mulot contre attaque -+-