tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Adding functions to libutil, part 1



reinoud%netbsd.org@localhost (Reinoud Zandijk) writes:

>  int getdiskinfo(const char *s, int fd, const char *dt, struct disk_geom *geo,
>  	struct dkwedge_info *dkw);
>  int getdisksize(const char *name, u_int *secsize, off_t *mediasize);


There are kernel functions of the same name:

int getdiskinfo(struct vnode *vp, struct dkwedge_info *dkw)
int getdisksize(struct vnode *vp, uint64_t *numsecp, unsigned int *secsizep);

Maybe these should be aligned somewhat (starting with argument order).


Taking a name instead of a filehandle in fsck's getdisksize()
doesn't look that generic to me. The fsck code for getdiskinfo() is
also accessing the file through the handle and calling stat() on the
name.

IMO moving the functionality into libutil is a good thing. But just
moving the code (and multiplying its users) is maybe not.




Home | Main Index | Thread Index | Old Index