Date: Sat, 06 Oct 2001 12:29:02 -0700 From: Terry Lambert <tlambert2@mindspring.com> To: current@freebsd.org Subject: PATCH FOR KRIS: add stub ufswrite to libstand Message-ID: <3BBF5B7E.F6DD3AA6@mindspring.com>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------B2719BC1A25BD20F32C39CFC Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Here is a patch for adding a stub write function to libstand, so that you could, for example, reimplement in FORTH the nextboot utility, which was murdered when the new boot loader was added. This only implements a stub function, but it has comments that indicate the needed semantics in the presence of doing a write to a technically unmounted raw disk, so that it doesn't screw up your FS image. This is necewssary precursor work for actually supporting the fwrite FORTH verb in the previous patch (it'll fail to do the write in both cases, so neither are harmful). Please commit... K PLZ THX. -- Terry --------------B2719BC1A25BD20F32C39CFC Content-Type: text/plain; charset=us-ascii; name="ufswrite.pat.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ufswrite.pat.txt" Index: libstand/ufs.c =================================================================== RCS file: /home/cvs/FreeBSD/src/lib/libstand/ufs.c,v retrieving revision 1.5.6.1 diff -u -r1.5.6.1 ufs.c --- libstand/ufs.c 2000/05/04 13:47:53 1.5.6.1 +++ libstand/ufs.c 2001/08/29 00:36:19 @@ -82,6 +82,7 @@ static int ufs_open(const char *path, struct open_file *f); static int ufs_close(struct open_file *f); static int ufs_read(struct open_file *f, void *buf, size_t size, size_t *resid); +static int ufs_write(struct open_file *f, void *buf, size_t size, size_t *resid); static off_t ufs_seek(struct open_file *f, off_t offset, int where); static int ufs_stat(struct open_file *f, struct stat *sb); static int ufs_readdir(struct open_file *f, struct dirent *d); @@ -91,7 +92,7 @@ ufs_open, ufs_close, ufs_read, - null_write, + ufs_write, ufs_seek, ufs_stat, ufs_readdir @@ -613,6 +614,21 @@ free(fp->f_fs); free(fp); return (0); +} + +/* + * Copy kernel memory into a portion of a file. + * Cross block boundaries when necessary, but do not exceed + * the orginal length of the file, nor truncate it. + */ +static int +ufs_write(f, start, size, resid) + struct open_file *f; + void *start; + size_t size; + size_t *resid; /* out */ +{ + return (ENOENT); /* NOTIMP! */ } /* --------------B2719BC1A25BD20F32C39CFC-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3BBF5B7E.F6DD3AA6>