From owner-freebsd-questions@FreeBSD.ORG Fri May 2 18:28:09 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 20B4937B401 for ; Fri, 2 May 2003 18:28:09 -0700 (PDT) Received: from thalia.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 183ED43F75 for ; Fri, 2 May 2003 18:28:06 -0700 (PDT) (envelope-from keramida@ceid.upatras.gr) Received: from gothmog.gr (patr530-b198.otenet.gr [212.205.244.206]) by thalia.otenet.gr (8.12.9/8.12.9) with ESMTP id h431S2mX015847; Sat, 3 May 2003 04:28:03 +0300 (EEST) Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.12.9/8.12.9) with ESMTP id h431S1oP001851; Sat, 3 May 2003 04:28:02 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from giorgos@localhost) by gothmog.gr (8.12.9/8.12.9/Submit) id h431S1dr001850; Sat, 3 May 2003 04:28:01 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Sat, 3 May 2003 04:28:00 +0300 From: Giorgos Keramidas To: Joshua Oreman Message-ID: <20030503012800.GC1747@gothmog.gr> References: <200305022353.h42NreOY018887@clunix.cl.msu.edu> <20030503000330.GA98398@falcon.midgard.homeip.net> <54693.192.85.47.1.1051923045.squirrel@new.host.name> <20030503010727.GA28640@webserver.get-linux.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030503010727.GA28640@webserver.get-linux.org> cc: questions@freebsd.org Subject: Re: Zeros and ones X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 May 2003 01:28:09 -0000 On 2003-05-02 18:07, Joshua Oreman wrote: >On Fri, May 02, 2003 at 05:50:45PM -0700 or thereabouts, Kevin Stevens seemed to write: >>> On Fri, May 02, 2003 at 07:53:40PM -0400, Jerry McAllister wrote: >>>> Hi, >>>> >>>> This should be easy, but short of writing something specific to do it, >>>> I am not getting my head around how. >>>> >>>> It is easy and convenient to use /dev/zero to write out a number of >>>> zero bytes to somewhere - as in: >>>> >>>> But, I would like to write all ones - as in 0xff or maybe some >>>> other pattern - as if there was a /dev/one also. >> >> I absolutely can't believe it. At the exact time Jerry was struggling >> with this, I was working on *exactly* the same issue. Couldn't have >> phrased his question any better - I was actually looking in /dev for a >> "one" device! >> >> My way of resolving the problem, BTW, was to create a pure white bitmap in >> PhotoShop and trim it to the size I needed with "head". Different ways to >> skin the cat! ;) > > Yet another (theoretical) way to do it: > Create a 'rept' device driver in the kernel that uses ioctl() to set the > bytes to spew out. Base 'zero' on that. Could have a few uses... not :-) Not. We have tr(1) already. dd if=/dev/zero | tr '\000' '\xxx' >filename is the canonical way of creating ANY type of file that contains \xxx bytes, and it doesn't require special kernel hacking skills to work on any number of platforms :-)