From owner-freebsd-current Sat Oct 6 12:28:18 2001 Delivered-To: freebsd-current@freebsd.org Received: from falcon.mail.pas.earthlink.net (falcon.mail.pas.earthlink.net [207.217.120.74]) by hub.freebsd.org (Postfix) with ESMTP id 0F08337B406 for ; Sat, 6 Oct 2001 12:28:14 -0700 (PDT) Received: from mindspring.com (dialup-209.245.131.216.Dial1.SanJose1.Level3.net [209.245.131.216]) by falcon.mail.pas.earthlink.net (8.11.5/8.9.3) with ESMTP id f96JSC618757 for ; Sat, 6 Oct 2001 12:28:13 -0700 (PDT) Message-ID: <3BBF5B7E.F6DD3AA6@mindspring.com> Date: Sat, 06 Oct 2001 12:29:02 -0700 From: Terry Lambert Reply-To: tlambert2@mindspring.com X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: current@freebsd.org Subject: PATCH FOR KRIS: add stub ufswrite to libstand Content-Type: multipart/mixed; boundary="------------B2719BC1A25BD20F32C39CFC" Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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