JPH1124979A - Information recording method - Google Patents

Information recording method

Info

Publication number
JPH1124979A
JPH1124979A JP9178121A JP17812197A JPH1124979A JP H1124979 A JPH1124979 A JP H1124979A JP 9178121 A JP9178121 A JP 9178121A JP 17812197 A JP17812197 A JP 17812197A JP H1124979 A JPH1124979 A JP H1124979A
Authority
JP
Japan
Prior art keywords
file
data
sector
rewritten
directory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP9178121A
Other languages
Japanese (ja)
Inventor
Masahiro Tamegai
正博 為我井
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP9178121A priority Critical patent/JPH1124979A/en
Publication of JPH1124979A publication Critical patent/JPH1124979A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To reduce a processing speed and to drastically save record capacity by adding only a sector that includes data to be rewritten among files recorded on a record medium. SOLUTION: A device driver calculates a sector address that includes a data area which is made a rewrite request from an application, that is, a rewrite start sector and end sector (step 201). The device driver controls drive, reads data of a sector corresponding to it from an optical card and stores it in a buffer which is reserved by the device driver (step 202). Data to be rewritten are overwritten on data of the buffer, and the data of the buffer are rewritten (step 203). When data rewrite is finished, the data stored in the buffer are recorded on an optical card (step 204). Consequently, the larger a file size is, the less the possibility that the capacity of record medium drops is, and information can be effectively rewritten.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、情報記録媒体に情
報を記録する情報記録方法、特に既存のファイルのデー
タを書き換える方法に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an information recording method for recording information on an information recording medium, and more particularly to a method for rewriting data in an existing file.

【0002】[0002]

【従来の技術】従来、情報記録担体としては、光学的に
情報を記録再生する光ディスクや光カード、磁気的に情
報を記録再生する固定磁気ディスクやフロッピーディス
クなどが知られている。一般に、これらの情報記録担体
は複数のセクタからなるトラックで構成され、このトラ
ックには担体製造時またはフォーマット時に担体中の位
置を示すトラックアドレスが付与されている。そして、
情報を記録再生する場合は、このトラックアドレスをも
とに所望のトラックを探し、目的のトラックに情報の記
録、再生が行われる。また、各々のセクタにもトラック
アドレスに準じてセクタアドレスが割り当てられてい
る。
2. Description of the Related Art Hitherto, as information recording carriers, optical disks and optical cards for optically recording and reproducing information, and fixed magnetic disks and floppy disks for magnetically recording and reproducing information have been known. In general, these information recording carriers are composed of a track composed of a plurality of sectors, and a track address indicating a position in the carrier at the time of manufacturing or formatting the carrier is assigned to the track. And
When recording and reproducing information, a desired track is searched based on the track address, and information is recorded and reproduced on a target track. Each sector is also assigned a sector address according to the track address.

【0003】ところで、ハードディスクやフロッピーデ
ィスクのような汎用のブロックデバイス(ランダムアク
セスデバイス)には、OS(Operating System)に最初
からデバイスドライバーが付属しているのが普通であ
る。一方、光カードのような新規な記録担体には、通
常、ドライブメーカーからデバイスドライバーやライブ
ラリが提供され、光カードは追記型記録担体ではある
が、これらのデバイスドライバーやライブラリを用いる
ことで、光カードの各セクタに対して擬似ランダムアク
セスを可能としている。
A general-purpose block device (random access device) such as a hard disk or a floppy disk usually has a device driver attached to an OS (Operating System) from the beginning. On the other hand, a new record carrier such as an optical card is usually provided with a device driver and a library from a drive maker, and the optical card is a write-once record carrier. Pseudo random access is enabled for each sector of the card.

【0004】次に、このようなデバイスドライバーを用
いて光カードにファイルデータを記録する方法について
説明する。図13に光カードの記録面を示している。ま
ず、光カード1の記録領域はディレクトリ領域Aとデー
タ領域Bに分けられている。1セクタの容量は512バ
イトとする。また、この光カード1にはファイルAのデ
ータがセクタS0〜S2に記録され、ディレクトリ領域
にはファイルAを管理するためのディレクトリD1が記
録されているものとする。図14はディレクトリD1の
内容を示している。ディレクトリ番号9は“1”、ファ
イル名10は“ファイルA”、先頭セクタアドレス11
は“0”、専有セクタ数12は“3”、ファイルの容量
13は“1536バイト”である。また、アペンド番号
14、消去フラグ15については詳しく後述する。
Next, a method of recording file data on an optical card using such a device driver will be described. FIG. 13 shows the recording surface of the optical card. First, the recording area of the optical card 1 is divided into a directory area A and a data area B. The capacity of one sector is 512 bytes. It is also assumed that the data of the file A is recorded in the sectors S0 to S2 on the optical card 1, and the directory D1 for managing the file A is recorded in the directory area. FIG. 14 shows the contents of the directory D1. The directory number 9 is “1”, the file name 10 is “file A”, and the first sector address 11
Is "0", the number of exclusive sectors 12 is "3", and the file capacity 13 is "1536 bytes". The append number 14 and the erasure flag 15 will be described later in detail.

【0005】このような光カードにファイルBを記録す
る場合の方法について図15を参照して説明する。ファ
イルBは、例えば1200バイトとする。図15におい
て、まず、ステップ101で記録用にファイルBをオー
プンする。このときは、光カードへの記録は何も行わな
い。次いで、ステップ102でファイルBのデータを光
カードに記録する。セクタS0〜S2は既に記録済であ
るので、図13のようにファイルBのデータはセクタS
3〜S5に記録する。記録を終了すると、ステップ10
3でファイルBをクローズする。
A method for recording the file B on such an optical card will be described with reference to FIG. The file B is, for example, 1200 bytes. In FIG. 15, first, in step 101, a file B is opened for recording. At this time, nothing is recorded on the optical card. Next, in step 102, the data of the file B is recorded on the optical card. Since the sectors S0 to S2 have already been recorded, the data of the file B is stored in the sector S as shown in FIG.
Record in 3-S5. When recording is completed, step 10
In step 3, file B is closed.

【0006】ファイルのクローズは、光カード1にファ
イルBを管理するためのディレクトリD2を記録するこ
とによって行う。図14にディレクトリD2の内容を示
している。ディレクトリ番号は“2”、ファイル名は
“ファイルB”、先頭セクタアドレスは“3”、セクタ
数は“3”、ファイルの容量は“1200バイト”であ
る。
[0006] The file is closed by recording a directory D2 for managing the file B on the optical card 1. FIG. 14 shows the contents of the directory D2. The directory number is “2”, the file name is “file B”, the start sector address is “3”, the number of sectors is “3”, and the file capacity is “1200 bytes”.

【0007】ここで、アペンドフラグは、光カードの既
存のファイルにデータを追加するときにファイルを1つ
のファイルとして管理するために用いられる。また、消
去フラグはファイルを擬似的に消去するのに用いられ
る。本願出願人は光カードにファイルをアペンドする方
法を、特開平1−258288号公報、特開平4−14
1867号公報などで公開している。即ち、ディレクト
リ中にファイルデータの追加を示す番号(アペンドフラ
グ)を設け、既存のファイルにデータを追加する場合
は、追加すべきデータを別ファイルとして記録し、ディ
レクトリ部に追加ファイルデータ(部分ファイル)を管
理するディレクトリをアペンドフラグをインクリメント
して記録することによって、ファイル名が同名で、アペ
ンドフラグが異なるファイルはアペンドフラグの番号順
に分割された1つのファイルとして管理するというもの
である。
Here, the append flag is used for managing a file as one file when adding data to an existing file on the optical card. The deletion flag is used to delete a file in a pseudo manner. The applicant of the present invention has disclosed a method of appending a file to an optical card in Japanese Patent Application Laid-Open Nos. 1-258288 and 4-14.
It is disclosed in, for example, Japanese Patent Publication No. 1867. That is, a number (append flag) indicating the addition of file data is provided in the directory, and when adding data to an existing file, the data to be added is recorded as a separate file, and the additional file data (partial file ) Is recorded by incrementing the append flag, and files having the same file name but different append flags are managed as one file divided in the order of the append flag number.

【0008】次に、ファイルをアペンドする方法につい
て説明する。まず、図13に示すようファイルAとファ
イルBが記録された光カードのファイルのうち、ファイ
ルAに200バイトのデータをアペンドするものとして
説明する。図13のセクタS0〜S2はファイルA、セ
クタS3〜S5はファイルBのデータである。この状態
で、ファイルAにデータを追記するには、まず、ファイ
ルAをアペンドモードでオープンし、その後、アペンド
するデータを光カードに記録する。光カードにはセクタ
S5までデータが記録されているので、追加するデータ
はセクタS6に記録する。
Next, a method of appending a file will be described. First, a description will be given assuming that 200 bytes of data are appended to file A among the files of the optical card on which file A and file B are recorded as shown in FIG. In FIG. 13, sectors S0 to S2 are data of file A, and sectors S3 to S5 are data of file B. To add data to file A in this state, first, file A is opened in append mode, and then the data to be appended is recorded on the optical card. Since data is recorded on the optical card up to the sector S5, additional data is recorded on the sector S6.

【0009】次いで、ファイルAをクローズする場合
は、追加ファイルを管理するためのディレクトリD3を
記録する。図16はこのようにして記録されたセクタS
6、ディレクトリD3を示している。また、図17にデ
ィレクトリD3の内容を示している。この場合は、ディ
レクトリ番号は“3”、ファイル名は“ファイルA、先
頭セクタアドレスは“6”、セクタ数は“1”、ファイ
ルの容量は“200バイト”となっている。また、アペ
ンドフラグ14は、図14のファイルAのディレクトリ
D1のアペンド番号“1”をインクリメントして“2”
となっている。このように追加ファイルのディレクトリ
は元のファイル名と同一とし、また、アペンドフラグを
インクリメントしてファイルの追加を行うことにより、
ファイルAはデイレクトリD1、D3からアペンドフラ
グ1、2の順に分割記録されていることがわかり、ファ
イル名が同一のファイルは1つのファイルとして管理す
ることができる。
Next, when closing the file A, a directory D3 for managing an additional file is recorded. FIG. 16 shows the sector S recorded in this manner.
6, directory D3. FIG. 17 shows the contents of the directory D3. In this case, the directory number is “3”, the file name is “file A, the head sector address is“ 6 ”, the number of sectors is“ 1 ”, and the file capacity is“ 200 bytes ”. 14 increments the append number "1" of the directory D1 of the file A in FIG.
It has become. In this way, the directory of the additional file is the same as the original file name, and the append flag is incremented to add the file,
It is understood that the file A is divided and recorded in the order of append flags 1 and 2 from the directories D1 and D3, and a file having the same file name can be managed as one file.

【0010】また、本願出願人は、追記型記録媒体に記
録されたファイルを擬似的に消去する方法を特開昭63
−91888号公報で公開している。この方法は、既に
記録されたファイルに対し消去したというディレクトリ
を記録することにより、ファイルを擬似的に消去すると
いうものである。従来においては、この消去方法を用い
て既にあるファイルの書き換えを行っている。この消去
方法について具体的に説明する。
[0010] The applicant of the present application has disclosed a method of erasing a file recorded on a write-once recording medium in a pseudo manner, as disclosed in
No. 91888. In this method, a file is erased in a pseudo manner by recording a directory indicating that an already recorded file has been erased. Conventionally, an existing file is rewritten using this erasing method. This erasing method will be specifically described.

【0011】まず、前述のように光カード1にファイル
AのデータがセクタS0〜S2、及びセクタS6に記録
され、ファイルBのデータがセクタS3〜S5に記録さ
れているものとし、ファイルBの先頭から600バイト
のオフセットの位置から100バイトのデータを書き換
えるものとする。ファイルBのデータの一部を書き換え
るには、ファイルBのデータを記録再生装置のバッファ
(図示せず)に蓄え、ファイルBを消去するため前述の
ような消去ディレクトリD4を光カードに記録する。図
17にこの消去ディレクトリD4の内容を示している。
消去ディレクトリD4の消去フラグ15は“1”となっ
ていて、このフラグが“1”の場合は、ファイルBは消
去されたとみなすものである。
First, as described above, it is assumed that the data of the file A is recorded in the sectors S0 to S2 and S6 on the optical card 1 and the data of the file B is recorded in the sectors S3 to S5. It is assumed that 100-byte data is rewritten from the position of the 600-byte offset from the head. To rewrite a part of the data of the file B, the data of the file B is stored in a buffer (not shown) of the recording / reproducing apparatus, and the erasure directory D4 as described above is recorded on the optical card to erase the file B. FIG. 17 shows the contents of the erase directory D4.
The erasure flag 15 of the erasure directory D4 is "1". When this flag is "1", the file B is regarded as having been erased.

【0012】一方、消去フラグが“0”の場合は、新た
に記録されたファイルであるか、追記されたデータを管
理するためのディレクトリであることを示している。次
に、バッファに蓄えているデータの先頭から600バイ
トのオフセット位置から100バイトのデータを書き換
え、この書き換えたバッファのデータを図16に示すよ
うに光カードのセクタS7〜S9に記録する。また、図
16のようにセクタS7〜S9のデータを管理するため
のディレクトリD5を記録する。図17にディレクトリ
D5の内容を示している。ディレクトリD5は書き換え
後のファイルBのセクタS7〜S9のデータを管理する
もので、先頭セクタアドレスは“7”、セクタ数は
“3”になっている。
On the other hand, when the erasure flag is "0", it indicates that the file is a newly recorded file or a directory for managing additionally recorded data. Next, 100 bytes of data are rewritten from the offset position of 600 bytes from the head of the data stored in the buffer, and the rewritten data of the buffer is recorded in sectors S7 to S9 of the optical card as shown in FIG. Also, as shown in FIG. 16, a directory D5 for managing data of the sectors S7 to S9 is recorded. FIG. 17 shows the contents of the directory D5. The directory D5 manages the data of the sectors S7 to S9 of the rewritten file B, and has a leading sector address of "7" and a number of sectors of "3".

【0013】[0013]

【発明が解決しようとする課題】しかしながら、従来の
書き換え方法では、実際には書き換えていない部分を含
めてすべてのファイルデータを別の位置に再記録してい
るので、ファイルのサイズが大きいほど書き換えに要す
る領域が大きくなり、追記型記録媒体に記録できる実質
的な記録容量を低下させる原因となっていた。
However, in the conventional rewriting method, all the file data including the part which is not actually rewritten is re-recorded at another position. And the area required for recording on the write-once type recording medium is reduced.

【0014】本発明は、上記従来の問題点に鑑み、書き
換えるデータを含むセクタのみを書き換えて追記するこ
とにより、記録媒体の容量が低下することがない情報記
録方法を提供することを目的とする。
The present invention has been made in consideration of the above-described conventional problems, and has as its object to provide an information recording method in which the capacity of a recording medium is not reduced by rewriting only a sector including data to be rewritten and additionally recording. .

【0015】[0015]

【課題を解決するための手段】本発明の目的は、追記型
記録媒体に記録されている書換対象のファイルデータの
うち書き換えるべきデータを含んでいるセクタアドレス
を求めるステップと、前記セクタアドレスの書き換える
データを作成するステップと、作成されたデータを前記
記録媒体に追記するステップと、書換対象のファイルを
擬似的に消去するディレトクリを前記記録媒体に記録す
るステップと、書き換え後のファイルを管理するための
ディレクトリを作成し、前記記録媒体に記録するステッ
プとを有することを特徴とする情報記録方法によって達
成される。
SUMMARY OF THE INVENTION It is an object of the present invention to obtain a sector address including data to be rewritten among file data to be rewritten recorded on a write-once recording medium, and to rewrite the sector address. A step of creating data, a step of appending the created data to the recording medium, a step of recording a directory in which the file to be rewritten is erased in a pseudo manner, and a step of managing the rewritten file. And recording the directory on the recording medium.

【0016】[0016]

【発明の実施の形態】以下、本発明の実施の形態につい
て図面を参照して詳細に説明する。まず、本発明の第1
の実施形態について説明する。図1は本発明の第1の実
施形態に係るホストコンピュータと情報記録再生装置か
らなる情報記録再生システムの構成例を示している。図
1において、31は情報記録担体に情報を記録、再生す
る情報記録再生装置(以下、ドライブという)である。
ドライブ31は上位制御装置のホストコンピュータ32
に接続され、ホストコンピュータ32の制御に基づいて
情報の記録、再生を行う。情報記録担体としては光カー
ド1を用いている。37は不図示の搬送機構を駆動し
て、光カード1をドライブ31内の所定位置に導入し、
また、所定位置にて光カード1をR方向に往復移動さ
せ、更に光カード1を機外に排出するためのカード送り
モータである。38は光源の半導体レーザを含む光ビー
ム照射光学系であり、情報の記録、再生時には光源の光
ビームを微小光スポットに絞って光カード1上に照射す
る。
Embodiments of the present invention will be described below in detail with reference to the drawings. First, the first of the present invention
An embodiment will be described. FIG. 1 shows an example of the configuration of an information recording / reproducing system including a host computer and an information recording / reproducing device according to the first embodiment of the present invention. In FIG. 1, reference numeral 31 denotes an information recording / reproducing apparatus (hereinafter referred to as a drive) for recording and reproducing information on an information recording carrier.
The drive 31 is a host computer 32 of the host controller.
And records and reproduces information under the control of the host computer 32. The optical card 1 is used as an information recording carrier. 37 drives a transport mechanism (not shown) to introduce the optical card 1 into a predetermined position in the drive 31;
A card feed motor for reciprocating the optical card 1 in the R direction at a predetermined position and further discharging the optical card 1 out of the apparatus. Reference numeral 38 denotes a light beam irradiation optical system including a semiconductor laser as a light source, and irradiates the optical card 1 with a light beam of the light source focused on a minute light spot when recording and reproducing information.

【0017】また、39は光カード1から反射された光
を検出する光検出器、40は光ビーム照射光学系38の
一部を駆動して光カード1面上の光スポットのピント位
置をZ方向、即ち光カード面と垂直方向に移動させてオ
ートフォーカス制御を行うためのAFアクチュエータ、
41は光ビーム照射光学系38の一部を駆動して光カー
ド1面上の光スポットをY方向、即ち光カードの情報ト
ラックに直交する方向に移動させてオートトラッキング
制御を行うためのATアクチュエータである。これらの
光ビーム照射光学系38、光検出器39、AFアクチュ
エータ40、ATアクチュエータ41を含んで光ヘッド
50が構成されている。36は光ヘッド50をY方向に
移動させて光スポットを所望のトラックにアクセスする
ためのヘッド送りモータである。
Reference numeral 39 denotes a photodetector for detecting light reflected from the optical card 1; AF actuator for performing autofocus control by moving in the direction, that is, the direction perpendicular to the optical card surface,
Reference numeral 41 denotes an AT actuator for driving a part of the light beam irradiation optical system 38 to move a light spot on the optical card 1 in the Y direction, that is, in a direction orthogonal to the information track of the optical card, thereby performing an automatic tracking control. It is. An optical head 50 includes the light beam irradiation optical system 38, the photodetector 39, the AF actuator 40, and the AT actuator 41. Numeral 36 denotes a head feed motor for moving the optical head 50 in the Y direction to access the light spot to a desired track.

【0018】MPU33はドライブ31内の各部を制御
するためのプロセッサ回路であってROM、RAMを内
蔵している。MPU33はヘッド送りモータ36、カー
ド送りモータ37などを制御し、また、ホストコンピュ
ータ32とデータの送受信を行う。AT/AF制御回路
34は光検出器39からの出力信号をもとにAFアクチ
ュエータ40とATアクチュエータ41を駆動し、光ビ
ーム照射光学系38からの光スポットがカード面に焦点
を結ぶように、また、光スポットが情報トラックに追従
して走査するように、オートフォーカス制御とオートト
ラッキング制御を行う。
The MPU 33 is a processor circuit for controlling each unit in the drive 31, and has a built-in ROM and RAM. The MPU 33 controls a head feed motor 36, a card feed motor 37, and the like, and transmits and receives data to and from the host computer 32. The AT / AF control circuit 34 drives the AF actuator 40 and the AT actuator 41 based on the output signal from the photodetector 39 so that the light spot from the light beam irradiation optical system 38 is focused on the card surface. In addition, auto focus control and auto tracking control are performed so that the light spot scans following the information track.

【0019】変復調回路35はMPU33の制御に基づ
いて記録情報を変調し、再生情報を復調するための回路
である。情報の記録時には、ホストコンピュータ32か
らの記録データを変復調回路33で変調し、変調信号に
応じて光ビーム照射光学系38内の光源を駆動し、強度
変調された光ビームを情報トラック上に走査することに
よって、光カード1上に情報の記録を行う。
The modulation / demodulation circuit 35 is a circuit for modulating recording information under the control of the MPU 33 and demodulating reproduction information. At the time of recording information, the recording data from the host computer 32 is modulated by the modulation / demodulation circuit 33, the light source in the light beam irradiation optical system 38 is driven according to the modulation signal, and the intensity-modulated light beam is scanned on the information track. By doing so, information is recorded on the optical card 1.

【0020】また、情報の再生時には、光ビーム照射光
学系38から光カード1の情報トラック上に再生用の光
ビームを照射し、光検出器39で光カード1からの反射
光を検出する。そして、変復調回路35で光検出器39
の信号をもとに2値化、復調などの所定の信号処理を行
うことによって記録情報の再生を行う。なお、一般に光
カード1は媒体の性質上エラー率が高いので、信頼性の
高い情報記録が要求される場合は、誤り訂正手段が必要
である。
At the time of reproducing information, a light beam for reproduction is irradiated onto the information track of the optical card 1 from the light beam irradiation optical system 38, and the light detector 39 detects the reflected light from the optical card 1. Then, a photodetector 39 is provided by the modulation / demodulation circuit 35.
The recorded information is reproduced by performing predetermined signal processing such as binarization and demodulation based on the signal. In general, the optical card 1 has a high error rate due to the nature of the medium, and therefore, if highly reliable information recording is required, an error correction means is required.

【0021】ここで、通常、ホストコンピュータ32に
は、2次記憶装置としてハードディスクやフロッピーデ
ィスクが搭載され、これらのハードディスクやフロッピ
ーディスクのデバイスドライバーは予めOSに標準で装
備されている。一方、新規デバイスである光カード用の
デバイスドライバーは、前述のようにドライブメーカー
が提供しており、従来のデバイスと同様の機能を提供す
ることによって、アプリケーションの開発を容易にして
いる。
Here, usually, a hard disk or a floppy disk is mounted on the host computer 32 as a secondary storage device, and device drivers for the hard disk and the floppy disk are previously provided as standard equipment in the OS. On the other hand, a device driver for an optical card, which is a new device, is provided by a drive maker as described above, and provides functions similar to those of a conventional device, thereby facilitating application development.

【0022】次に、以上のような光カード用のデバイス
ドライバーについて説明する。本実施形態で用いるデバ
イスドライバーは、UNIXやMS−DOSで使用され
ているハードディスクやフロッピーディスクのデバイス
ドライバーと同様に、ファイルのオープンや書き込み、
読み出し、ファイルのクローズ機能を備えている。ま
た、UNIXやMS−DOSではC言語が主流である
が、このC言語にはファイルとしてデータを記録するた
めの関数であるfopen ( ) 、fread ( ) 、fwrite ()、f
seek ( ) 、fclose ( )が標準で用意されている。これ
らの関数は、各種ランダムデバイスのデバイスドライバ
ーにアクセスする簡単な方法であり、ANSI−X3J
11(American National Standards Institute X3j11
)にも規定されている。
Next, a device driver for the above optical card will be described. The device driver used in this embodiment is similar to the device driver of a hard disk or a floppy disk used in UNIX or MS-DOS, and is used to open and write files.
It has read and file close functions. In UNIX and MS-DOS, the C language is mainstream. In the C language, functions fopen (), fread (), fwrite (), fwrite (), which are functions for recording data as files.
seek () and fclose () are provided as standard. These functions are a simple way to access the device drivers of various random devices, ANSI-X3J
11 (American National Standards Institute X3j11
).

【0023】これらの関数の構文について説明する。ま
ず、fopen( )関数の構文は、 FILE *fopen(const char *filename, const char *mode
) ; である。filenameはオープンすべきファイル名のアドレ
ス、modeはオープンすべきファイルのモードを記述した
メモリのアドレスである。モードには“記録”、“読み
取り”、“追記”(アペンド)などがある。また、関数
の戻り値は、FILE構造体のアドレスであり、fwrite( )、
fread( )、fseek( )、fclose( ) などのファイルアクセス
関数で使用される。なお、以下の記述中で、size tは、
通常、unsigned intに置き換えられる。
The syntax of these functions will be described. First, the syntax of the fopen () function is FILE * fopen (const char * filename, const char * mode
); filename is the address of the file name to be opened, and mode is the address of a memory that describes the mode of the file to be opened. The modes include “record”, “read”, and “append” (append). The return value of the function is the address of the FILE structure, fwrite (),
Used by file access functions such as fread (), fseek (), fclose (). In the following description, size t is
Usually replaced by unsigned int.

【0024】fwrite( ) 関数の構文は、 size t fwrite (const void *ptr, size t size, size
t n FILE *stream ); である。ptr は記録データのアドレス、size*nは記録デ
ータの大きさ、streamはfopen( )関数の戻り値であるFI
LE構造体のアドレスである。
The syntax of the fwrite () function is size t fwrite (const void * ptr, size t size, size
tn FILE * stream); ptr is the address of the recording data, size * n is the size of the recording data, and stream is the return value of the fopen () function.
This is the address of the LE structure.

【0025】fread( )関数の構文は、 size t fread (void *ptr, size t size, size t n, FI
LE *stream); である。ptr は記録データのアドレス、size*nは記録デ
ータの大きさ、streamはfopen( )関数の戻り値であるFI
LE構造体のアドレスである。
The syntax of the fread () function is size t fread (void * ptr, size t size, size tn, FI
LE * stream); ptr is the address of the recording data, size * n is the size of the recording data, and stream is the return value of the fopen () function.
This is the address of the LE structure.

【0026】fclose( ) 関数の構文は、 int fclose (FILE *stream); である。streamはfopen ( ) 関数の戻り値を指定する。The syntax of the fclose () function is int fclose (FILE * stream); stream specifies the return value of the fopen () function.

【0027】次に、本実施形態による情報の記録方法に
ついて具体的に説明する。なお、本実施形態では、先に
説明したアペンド番号、消去フラグを用いてファイル管
理を行うものとし、セクタサイズは512バイトとす
る。また、本実施形態では、図13に示すように光カー
ド1上にファイルA、ファイルB、及びそれを管理する
ためのディレクトリD1、D2が記録されているものと
し、そのうちファイルBのデータの先頭から600バイ
トのオフセット位置から100バイトの大きさのデータ
を書き換えるものとする。なお、光カード1は図1のド
ライブ31にセットされ、光カード1に記録されている
すべてのディレクトリD1、D2(図14)はデバイス
ドライバーのワークメモリ(図示せず)内に読み込まれ
ているものとする。
Next, the information recording method according to the present embodiment will be specifically described. In the present embodiment, it is assumed that file management is performed using the append number and the erase flag described above, and the sector size is 512 bytes. In the present embodiment, as shown in FIG. 13, it is assumed that the file A, the file B, and the directories D1 and D2 for managing the file A and the file B are recorded on the optical card 1, and among the data of the file B, It is assumed that the data having a size of 100 bytes is rewritten from the offset position of 600 bytes from. The optical card 1 is set in the drive 31 shown in FIG. 1, and all directories D1 and D2 (FIG. 14) recorded on the optical card 1 are read into the work memory (not shown) of the device driver. Shall be.

【0028】ファイルBの一部のデータを書き換える場
合、通常、ホストコンピュータ32上のアプリケーショ
ンからデバイスドライバーに対し、fopen( )関数を使用
して読み書き用にファイルBをオープンする。デバイス
ドライバーでは、ワークメモリ内のディレクトリにファ
イルBのエントリが存在するかどうかを調べ、もし、存
在しない場合はfopen( )関数の戻り値によってアプリケ
ーションにエラーを通知する。また、ファイルBのエン
トリが存在する場合は、アプリケーションは書き換える
目的のアドレスまでファイルポインタを移動するため、
fseek( )関数を実行する。この場合は、ファイルBの先
頭から600バイト目以降のデータを書き換えるので、
whence引数にファイルの最初を示すパラメータを指定
し、offset引数に600を指定する。
When rewriting a part of the data in the file B, usually, the application on the host computer 32 opens the file B for reading and writing by using the fopen () function to the device driver. The device driver checks whether the entry of the file B exists in the directory in the work memory, and if it does not exist, notifies the application of an error by a return value of the fopen () function. When the entry of the file B exists, the application moves the file pointer to the target address to be rewritten.
Execute the fseek () function. In this case, since the data after the 600th byte from the beginning of file B is rewritten,
A parameter indicating the beginning of the file is specified in the whence parameter, and 600 is specified in the offset parameter.

【0029】次いで、アプリケーションは、fwrite( )
関数に書き換えるべきデータ(100バイトの大きさ)
を指定する。図2はこのfwrite( ) 関数に対するデバイ
スドライバーの処理を示している。図2において、ま
ず、デバイズライバーはステップ201でアプリケーシ
ョンから書き換え要求のあったデータ領域を含むセクタ
アドレス、即ち書き換える開始セクタと終了セクタのア
ドレスを算出する。この場合は、書き換えるデータのア
ドレスは600から699であるので、このアドレスか
ら書き換えるセクタアドレスを算出する。書き換える開
始セクタのアドレスは次の(1)式で得られる。但し、
以下の計算は、すべて小数点以下を切り捨てて整数域で
行うものとする。
Next, the application executes fwrite ()
Data to be rewritten into a function (100 bytes in size)
Is specified. FIG. 2 shows the processing of the device driver for the fwrite () function. In FIG. 2, first, in step 201, the device driver calculates a sector address including a data area requested to be rewritten by an application, that is, the addresses of a start sector and an end sector to be rewritten. In this case, since the address of the data to be rewritten is from 600 to 699, the sector address to be rewritten is calculated from this address. The address of the start sector to be rewritten is obtained by the following equation (1). However,
The following calculations are all performed in the integer range with the decimal part rounded down.

【0030】 開始セクタ=(書き換えるデータの先頭アドレス/セクタサイズ) +ファイルの先頭セクタアドレス …(1) 書き換えるデータの先頭アドレスは600、セクタサイ
ズは512、ファイルBの先頭セクタアドレスは3であ
るので、開始セクタアドレス=(600/512)+3
=4となる。
Start sector = (start address of data to be rewritten / sector size) + start sector address of file ... (1) Since the start address of the data to be rewritten is 600, the sector size is 512, and the start sector address of file B is 3, , Start sector address = (600/512) +3
= 4.

【0031】また、書き換える終了セクタのアドレスは
次の(2)式で得られる。
The address of the end sector to be rewritten is obtained by the following equation (2).

【0032】 終了セクタ=(書き換えるデータの終了アドレス/セクタサイズ) +ファイルの先頭セクタアドレス …(2) 書き換えるデータの終了アドレスは699、セクタサイ
ズは512、ファイルBの先頭セクタアドレスは3であ
るので、 終了セクタアドレス=(699/512)+3=4 となる。以上の結果から開始セクタアドレス、終了セク
タアドレスともに4となり、デバイスドライバーでは、
ステップ202でドライブ31を制御し、これに対応す
るセクタS4のデータを光カード1から読み出し、デバ
イスドライバーが確保しているバッファに格納する。
End sector = (end address of data to be rewritten / sector size) + first sector address of file ... (2) Since the end address of the data to be rewritten is 699, the sector size is 512, and the first sector address of file B is 3, End sector address = (699/512) + 3 = 4. From the above results, both the start sector address and the end sector address are 4, and the device driver calculates
In step 202, the drive 31 is controlled to read the corresponding data of the sector S4 from the optical card 1 and store the data in the buffer secured by the device driver.

【0033】次いで、デバイスドライバーではステップ
203で書き換えるデータをバッファのデータに上書き
し、バッファのデータを書き換える。データの書き換え
を終了すると、ステップ204でドライブ31を制御
し、バッファに格納しているデータを光カード1に記録
する。この場合は、図13に示すようにセクタS5まで
記録済であるので、その次のセクタS6に記録する。図
4はこのようにして記録された後の光カードを示してい
る。セクタS6はファイルBの書き換えられたセクタの
データである。以上でアプリケーションのfwrite( ) 関
数による記録要求に対しての処理を終了する。なお、セ
クタの全部のデータを書き換える場合は、光カードから
データを読み出す必要はなく、バッファ上で書き換える
データを作成すればよい。これは、以下の説明において
すべて同じである。
Next, the device driver overwrites the data to be rewritten in step 203 with the data in the buffer, and rewrites the data in the buffer. When the data rewriting is completed, the drive 31 is controlled in step 204, and the data stored in the buffer is recorded on the optical card 1. In this case, since the data has been recorded up to the sector S5 as shown in FIG. 13, the data is recorded in the next sector S6. FIG. 4 shows the optical card after recording in this manner. Sector S6 is the data of the rewritten sector of file B. Thus, the processing for the recording request by the fwrite () function of the application ends. When rewriting all the data in the sector, it is not necessary to read the data from the optical card, but it is sufficient to create the data to be rewritten on the buffer. This is all the same in the following description.

【0034】次に、アプリケーションからfclose( ) 関
数によるクローズ要求が発行された場合のデバイスドラ
イバーの処理について説明する。図3はこの場合のデバ
イスドライバーのクローズ処理を示している。図3にお
いて、まず、デバイスドライバーでは、ステップ301
で書き換え要求のあったファイルBを擬似的に消去す
る。このファイルの消去は、従来と同様に消去ディレク
トリを記録することによってファイルの擬似的消去を行
う。図5にこの場合の消去ディレクトリD3を示してい
る。消去ディレクトリD3は、ディレクトリ番号
“3”、ファイル名“ファイルB”、消去フラグ
“1”、その他は全て“0”となっていて、前述のよう
に消去フラグを“1”とすることによってファイルBは
消去されたとみなすものである。なお、図5において、
ディレクトリD1、D2は図14と同じディレクトリで
ある。
Next, the processing of the device driver when the application issues a close request by the fclose () function will be described. FIG. 3 shows the closing process of the device driver in this case. In FIG. 3, first, in the device driver, step 301
The file B for which rewriting has been requested is deleted in a pseudo manner. This file erasure is performed by pseudo-erasing the file by recording an erasure directory as in the conventional case. FIG. 5 shows the erase directory D3 in this case. The erasure directory D3 has a directory number "3", a file name "file B", an erasure flag "1", and all others are "0". By setting the erasure flag to "1" as described above, the file is deleted. B is considered to be erased. In FIG. 5,
Directories D1 and D2 are the same directories as in FIG.

【0035】また、デバイスドライバーでは、ステップ
302において書き換えた後のファイルBを管理するた
めの管理情報を作成する。具体的には、図5に示すよう
にD4からD5までの3つのディレクトリからなる管理
情報を作成する。D4はファイルBを構成する先頭セク
タS3のデータを管理するためのディレクトリ、D5は
ファイルBのもとのセクタS4を書き換えたセクタS6
のデータを管理するためのディレクトリ、D6はセクタ
S5のデータを管理するためのディレクトリである。
In the device driver, management information for managing the rewritten file B in step 302 is created. More specifically, as shown in FIG. 5, management information including three directories D4 to D5 is created. D4 is a directory for managing data of the first sector S3 constituting the file B, and D5 is a sector S6 obtained by rewriting the original sector S4 of the file B.
D6 is a directory for managing the data of the sector S5.

【0036】ディレクトリD4は図5に示すようにディ
レクトリ番号“4”、ファイル名“ファイルB”、先頭
セクタアドレス“3”、セクタ数“1”、セクタ容量
“512”、アペンド番号“1”、消去フラグ“0”で
ある。ディレクトリD5はディレクトリ番号“5”、先
頭セクタアドレス“6”、セクタ数“1”、セクタ容量
“512”、アペンド番号“2”である。ディレクトリ
D6はディレクトリ番号“6”、先頭セクタアドレス
“5”、セクタ数“1”、セクタ容量“176”、アペ
ンド番号“3”である。
As shown in FIG. 5, the directory D4 has a directory number "4", a file name "file B", a head sector address "3", a sector number "1", a sector capacity "512", an append number "1", The erasure flag is “0”. The directory D5 has a directory number “5”, a head sector address “6”, a sector number “1”, a sector capacity “512”, and an append number “2”. The directory D6 has a directory number “6”, a head sector address “5”, a sector number “1”, a sector capacity “176”, and an append number “3”.

【0037】管理情報を作成すると、デバイスドライバ
ーでは、ステップ303でドライブ31を制御し、作成
した管理情報を光カード1のディレクトリ領域に記録す
る。図4の消去ディレクトリD3、デイレクトリD4〜
D6はファイルのクローズ処理によって記録されたディ
レクトリである。以上でファイルBの一部のデータを書
き換える処理を終了する。
When the management information is created, the device driver controls the drive 31 in step 303 and records the created management information in the directory area of the optical card 1. The erase directory D3 and the directories D4 to D4 in FIG.
D6 is a directory recorded by the file closing process. Thus, the process of rewriting a part of the data of the file B is completed.

【0038】次に、以上のようにデータを記録した光カ
ード1をドライブ31から一旦取り出し、再びドライブ
31にセットしてファイルBを再生する動作について説
明する。なお、光カード1は既にドライブ31にセット
され、デバイスドライバーのワークメモリに光カード1
のすべてのディレクトリ(図5のディレクトリ)が読み
込まれているものとする。アプリケーションから読み取
り用にファイルBをオープンする場合、fopen( )関数が
用いられる。
Next, the operation of once removing the optical card 1 on which data has been recorded as described above from the drive 31 and setting it in the drive 31 again to reproduce the file B will be described. The optical card 1 is already set in the drive 31, and the optical card 1 is stored in the work memory of the device driver.
It is assumed that all directories (the directories in FIG. 5) have been read. When the file B is opened for reading from the application, the fopen () function is used.

【0039】このオープン要求に対し、デバイスドライ
バーではワークメモリに読み込んでいるディレクトリを
検索し、指定されたファイルBが光カード1に記録され
ているかどうかを確認する。ファイルBは消去ディレク
トリD3によって一旦擬似的に消去されているが、ファ
イルBに関してディレクトリD4〜D6が記録されてい
るので、ファイルBのオープンを正常に行うことができ
る。もし、指定されたファイル名がディレクトリ中に存
在しない場合は、アプリケーションにエラーを通知して
処理を終了する。
In response to this open request, the device driver searches the directory read into the work memory and checks whether the specified file B is recorded on the optical card 1. Although the file B is once pseudo-erased by the erasing directory D3, since the directories D4 to D6 are recorded for the file B, the file B can be normally opened. If the specified file name does not exist in the directory, an error is notified to the application and the processing ends.

【0040】次に、アプリケーションがファイルB(1
200バイト)を読む場合、まず、最初の512バイト
をディレクトリD4に従って読み出す。即ち、デバイス
ドライバーではドライブ31を制御し、図5のディレク
トリD4に従って最初のセクタS3のデータを読み出
し、アプリケーションに渡す。続いて、513バイト目
から1024バイト目まではディレクトリD5に従って
セクタS6のデータを読み出し、アプリケーションに渡
す。1025バイト目から1200バイト目まではディ
レクトリD6に従ってセクタS5のデータのうち最初の
176バイトを読み出し、アプリケーションに渡す。1
201バイト以降のデータの要求に対しては、どのディ
レクトリも管理していないので、“End of Fie”という
エラーコードをアプリケーションに渡して、要求がエラ
ーであることを通知する。以上でファイルBの読み出し
を終了する。
Next, the application transmits the file B (1
When reading (200 bytes), first, the first 512 bytes are read in accordance with the directory D4. That is, the device driver controls the drive 31, reads the data of the first sector S3 according to the directory D4 in FIG. 5, and transfers the data to the application. Subsequently, from the 513th byte to the 1024th byte, the data of the sector S6 is read in accordance with the directory D5 and passed to the application. From the 1025th byte to the 1200th byte, the first 176 bytes of the data of the sector S5 are read out according to the directory D6 and passed to the application. 1
Since no directory is managed for a request for data after 201 bytes, an error code "End of Fie" is passed to the application to notify that the request is an error. Thus, the reading of the file B is completed.

【0041】次に、以上はファイルBのセクタのうち中
央のセクタS4のデータを書き換える場合の説明である
が、ファイルBの先頭セクタのデータを書き換える場合
の方法ついて説明する。この場合も、図13のように光
カード1にファイルA、ファイルBが記録されていて、
そのうちファイルBのデータの先頭から100バイトの
オフセット位置から50バイトの大きさのデータを書き
換えるものとして説明する。
Next, the above description is for the case of rewriting the data of the central sector S4 of the sectors of the file B. The method for rewriting the data of the first sector of the file B will be described. Also in this case, the file A and the file B are recorded on the optical card 1 as shown in FIG.
The description will be made on the assumption that the data of the size of 50 bytes is rewritten from the offset position of 100 bytes from the head of the data of the file B.

【0042】ファイルBのデータの一部を書き換える場
合、同様にアプリケーションからデバイスドライバーに
対し、読み書き用にfopen( )関数を用いてファイルBを
オープンする。次いで、アプリケーションは書き換える
べき目的のアドレスまでファイルポインタを移動させる
ため、fseek( )関数を実行する。この場合は、ファイル
Bの先頭から100バイト目以降のデータを書き換える
ので、whence引数にファイルBの最初を示すパラメータ
を指定し、offset引数に100を指定する。続いて、ア
プリケーションではfwrite( ) 関数に書き換えるべきデ
ータを指定し、デバイスドライバーでは同様にこのfwri
te( ) 関数に対して図2の記録処理を実行する。
When a part of the data of the file B is rewritten, the file B is similarly opened from the application to the device driver using the fopen () function for reading and writing. Next, the application executes the fseek () function to move the file pointer to the target address to be rewritten. In this case, since the data after the 100th byte from the beginning of the file B is rewritten, the parameter indicating the beginning of the file B is specified in the whence parameter, and 100 is specified in the offset parameter. Next, the application specifies the data to be rewritten in the fwrite () function, and the device driver
The recording process of FIG. 2 is executed for the te () function.

【0043】まず、図2のステップ201で書き換え要
求のあったデータが記録されている開始セクタアドレス
と終了セクタアドレスを算出する。この場合は、書き換
えるデータのアドレスは100から149であるので、
このアドレスを用いて先の説明と同様に(1)、(2)
式によって書き換える開始セクタと終了セクタのアドレ
スを算出する。計算は同様に整数域で行う。書き換える
開始セクタアドレスは書き換えるデータの先頭アドレス
は100、セクタサイズは512、ファイルBの先頭セ
クタアドレスは3であるので、 開始セクタ=(100/512)+3 となる。また、書き換える終了セクタアドレスは、書き
換えるデータの終了アドレスは149であるので、 終了セクタ=(149/512)+3=3 となる。
First, in step 201 of FIG. 2, a start sector address and an end sector address where data requested to be rewritten are recorded are calculated. In this case, since the address of the data to be rewritten is from 100 to 149,
Using this address, as described above, (1), (2)
The addresses of the start sector and the end sector to be rewritten are calculated by the equations. The calculation is similarly performed in the integer range. The starting sector address to be rewritten is 100, the starting address of the data to be rewritten is 100, the sector size is 512, and the starting sector address of the file B is 3, so the starting sector is (100/512) +3. In addition, since the end address of the data to be rewritten is 149, the end sector = (149/512) + 3 = 3.

【0044】以上の結果から書き換える開始セクタアド
レス、終了セクタアドレスともに3となり、デバイスド
ライバーでは、ステップ202でこれに該当する光カー
ド1のセクタS3のデータを読み出し、バッファに格納
する。次いで、デバイスドライバーでは、ステップ20
3でバッファに読み込んだデータを書き換え、ステップ
204でドライブ31を制御してバッファのデータを光
カード1に記録する。この場合も、光カードはセクタS
5まで記録済であるので、セクタS6にバッファのデー
タを記録する。図6のセクタS6はこのようにして書き
換えられたセクタS3のデータである。
From the above results, both the start sector address and the end sector address to be rewritten are 3, and the device driver reads the data of the sector S3 of the optical card 1 corresponding to this at step 202 and stores it in the buffer. Next, in the device driver, step 20
In step 3, the data read into the buffer is rewritten, and in step 204, the drive 31 is controlled to record the data in the buffer on the optical card 1. Also in this case, the optical card is in sector S
5, the data of the buffer is recorded in the sector S6. The sector S6 in FIG. 6 is the data of the sector S3 rewritten in this manner.

【0045】次に、アプリケーションからfclose( ) 関
数によるクローズ要求が発行されると、デバイスドライ
バーは同様に図3のクローズ処理を実行する。まず、図
3のステップ301において消去ディレクトリを記録す
ることによって書き換え対象のファイルBを擬似的に消
去する。この場合の消去ディレクトリD3を図7に示し
ている。同様に消去フラグを“1”とすることによって
ファイルBを擬似的に消去する。次に、ステップ302
で書き換え後のファイルBを管理するための管理情報を
作成する。この場合は、図7に示すように2つのディレ
クトリD4、D5からなる管理情報を作成する。
Next, when a close request by the fclose () function is issued from the application, the device driver similarly executes the close processing of FIG. First, the file B to be rewritten is pseudo-erased by recording the erasure directory in step 301 of FIG. FIG. 7 shows the erase directory D3 in this case. Similarly, the file B is pseudo-erased by setting the erasure flag to “1”. Next, step 302
To create management information for managing the rewritten file B. In this case, management information including two directories D4 and D5 is created as shown in FIG.

【0046】ディレクトリD4はもとのセクタS3を書
き換えた後のセクタS6のデータを管理するための管理
情報、ディレクトリD5はファイルBのセクタS4、S
5のデータを管理するための管理情報である。この場合
は、ファイルBの先頭セクタS3のデータを書き換えて
いるので管理情報は2つとなる。ディレクトリD4は図
7のようにディレクトリ番号“4”、ファイル名“ファ
イルB”、先頭セクタアドレス“6”、セクタ数
“1”、セクタ容量“512”、アペンド番号“1”と
なる。また、ディレクトリD5は先頭セクタアドレス
“4”、セクタ数“2”、セクタ容量“688”(51
2+176)、アペンド番号“2”となる。次にデバイ
スドライバーはステップ303でドライブ31を制御
し、光カード1にディレクトリを記録してクローズ処理
を終了する。図6はクローズ処理後の光カードを示して
いる。ディレトクリD3〜D5は、クローズ処理によっ
て記録されたディレクトリである。
The directory D4 is management information for managing the data of the sector S6 after rewriting the original sector S3, and the directory D5 is the sectors S4, S of the file B.
5 is management information for managing the data of No. 5. In this case, since the data of the first sector S3 of the file B has been rewritten, the number of management information is two. As shown in FIG. 7, the directory D4 has a directory number "4", a file name "file B", a start sector address "6", a sector number "1", a sector capacity "512", and an append number "1". The directory D5 has a head sector address “4”, a sector number “2”, and a sector capacity “688” (51
2 + 176), and the append number is “2”. Next, the device driver controls the drive 31 in step 303, records the directory on the optical card 1, and ends the close processing. FIG. 6 shows the optical card after the closing processing. The directories D3 to D5 are directories recorded by the close processing.

【0047】次に、図6のようにデータを記録した光カ
ード1をドライブ31から一旦取り出し、再びドライブ
31にセットしてファイルBを読み出す場合、同様にア
プリケーションはfopen( )関数を用いて読み取り用にフ
ァイルBをオープンする。このアプリケーションからの
オープン要求に対し、デバイスドライバーはワークメモ
リに読み込んでいるディレクトリ(図7のディレクト
リ)を検索し、指定されたファイルBが光カード1に記
録されているかどうかを確認する。ファイルBは消去デ
ィレクトリD3によって一旦擬似的に消去されている
が、ファイルBに関してディレクトリD4〜D5が記録
されているので、ファイルBのオープンを正常に行うこ
とができる。
Next, when the optical card 1 on which data is recorded as shown in FIG. 6 is once taken out of the drive 31 and set in the drive 31 again to read the file B, the application similarly reads the file B using the fopen () function. Open file B for use. In response to the open request from this application, the device driver searches the directory (the directory in FIG. 7) read into the work memory and checks whether the specified file B is recorded on the optical card 1. Although the file B is once pseudo-erased by the erasure directory D3, since the directories D4 to D5 are recorded for the file B, the file B can be normally opened.

【0048】次いで、アプリケーションがファイルB
(1200バイト)を読む場合、まず最初の512バイ
トはディレクトリD4に従って読み出す。即ち、デバイ
スドライバーはドライブ31を制御し、図7のディレク
トリD4に従ってセクタS6のデータを読み出し、アプ
リケーションに渡す。続いて、513バイト目から12
00バイト目まではディレクトリD5に従ってセクタS
4、S5のデータを読み出し、アプリケーションに渡
す。1201バイト以降のデータの要求に対しては、ど
のディレクトリも管理していないので、“End of Fie”
というエラーコードをアプリケーションに渡して、要求
がエラーであることを通知する。以上でファイルBの読
み出しを終了する。
Next, if the application
When reading (1200 bytes), the first 512 bytes are read according to the directory D4. That is, the device driver controls the drive 31, reads the data in the sector S6 according to the directory D4 in FIG. 7, and transfers the data to the application. Next, 12 from the 513th byte
Up to the 00th byte, sector S according to directory D5
4. Read the data of S5 and pass it to the application. Since no directory is managed for a request for data after 1201 bytes, "End of Fie"
Is passed to the application to notify that the request is an error. Thus, the reading of the file B is completed.

【0049】次に、ファイルBのセクタのうち最後のセ
クタS5のデータを書き換える場合の方法について説明
する。この場合も、図13のように光カード1にファイ
ルAとファイルBが記録されていて、ファイルBのデー
タの先頭から1100バイトのオフセット位置から50
バイトの大きさのデータを書き換えるものとして説明す
る。ファイルBのデータの一部を書き換える場合、同様
にアプリケーションは読み書き用にfopen( )関数を用い
てファイルBをオープンし、また、書き換えるべき目的
のアドレスまでファイルポインタを移動させるため、fs
eek( )関数を実行する。この場合は、ファイルBの先頭
から1100バイト目以降のデータを書き換えるので、
whence引数にファイルBの最初を示すパラメータを指定
し、offset引数に1100を指定する。続いて、アプリ
ケーションではfwrite( ) 関数に書き換えるべきデータ
を指定し、デバイスドライバーでは同様にこのfwrite
( )関数に対して図2の処理を実行する。
Next, a method for rewriting data in the last sector S5 of the file B sectors will be described. In this case as well, the file A and the file B are recorded on the optical card 1 as shown in FIG.
The description will be made on the assumption that byte-sized data is rewritten. Similarly, when rewriting a part of the data of the file B, the application opens the file B using the fopen () function for reading and writing, and moves the file pointer to a target address to be rewritten.
Execute the eek () function. In this case, since the data after the 1100th byte from the beginning of file B is rewritten,
A parameter indicating the beginning of the file B is specified in the whence argument, and 1100 is specified in the offset argument. Next, the application specifies the data to be rewritten to the fwrite () function, and the device driver
(2) The processing of FIG. 2 is executed for the function.

【0050】まず、ステップ201で書き換え要求のあ
ったデータが記録されている開始セクタアドレスと終了
セクタアドレスを算出する。この場合は、書き換えるデ
ータのアドレスは1100から1149であるので、こ
のアドレスを用いて先の説明と同様に(1)、(2)式
によって書き換えるべき開始セクタと終了セクタのアド
レスを算出する。書き換える開始セクタアドレスは、書
き換えるデータの先頭アドレスは1100、セクタサイ
ズは512、ファイルBの先頭セクタアドレスは3であ
るので、 開始セクタ=(1100/512)+3=5 となる。また、終了セクタアドレスは書き換えるデータ
の終了アドレスは、1149であるので、 終了セクタ=(1149/512)+3=5 となる。
First, in step 201, a start sector address and an end sector address in which data requested to be rewritten are recorded are calculated. In this case, since the address of the data to be rewritten is from 1100 to 1149, the addresses of the start sector and the end sector to be rewritten are calculated by using the addresses according to the equations (1) and (2) as described above. The start sector address to be rewritten is 1100, the sector size is 512, the start sector address of the file B is 3, and the start sector = (1100/512) + 3 = 5. Also, since the end sector address of the data to be rewritten is 1149, the end sector = (1149/512) + 3 = 5.

【0051】以上の結果から書き換える開始セクタアド
レス、終了セクタアドレスともに5となり、デバイスド
ライバーでは、ステップ202でこれに該当する光カー
ド1のセクタS5のデータを読み出し、バッファに格納
する。次いで、デバイスドライバーでは、ステップ20
3でバッファに読み込んだデータを書き換え、ステップ
204でドライブ31を制御してバッファのデータを光
カード1に記録する。この場合も、光カードはセクタS
5まで記録済であるので、セクタS6にバッファのデー
タを記録する。
From the above result, both the start sector address and the end sector address to be rewritten are 5, and the device driver reads the data of the sector S5 of the optical card 1 corresponding to this in step 202 and stores it in the buffer. Next, in the device driver, step 20
In step 3, the data read into the buffer is rewritten, and in step 204, the drive 31 is controlled to record the data in the buffer on the optical card 1. Also in this case, the optical card is in sector S
5, the data of the buffer is recorded in the sector S6.

【0052】次に、アプリケーションからfclose( ) 関
数によるクローズ要求が発行されると、デバイスドライ
バーは同様に図3の処理を実行する。まず、ステップ3
01で消去ディレクトリを記録し、書き換え対象のファ
イルBを擬似的に消去する。この場合の消去ディレクト
リD3を図8に示している。同様に消去ディレクトリD
3の消去フラグを“1”としている。次に、ステップ3
02で書き換え後のファイルBを管理するための管理情
報を作成する。この場合も、図8に示すように2つのデ
ィレクトリD4、D5を作成する。
Next, when a close request by the fclose () function is issued from the application, the device driver similarly executes the processing of FIG. First, step 3
01, an erasure directory is recorded, and the file B to be rewritten is erased in a pseudo manner. FIG. 8 shows the erase directory D3 in this case. Similarly, delete directory D
3 is set to “1”. Next, step 3
In 02, management information for managing the rewritten file B is created. Also in this case, two directories D4 and D5 are created as shown in FIG.

【0053】ディレクトリD4はもとのセクタS3、S
4のデータを管理するための管理情報、ディレクトリD
5はもとのセクタS5書き換えた後のセクタS6のデー
タを管理するための管理情報である。ディレクトリD4
は図8に示すようにディレクトリ番号“4”、ファイル
名“ファイルB”、先頭セクタアドレス“3”、セクタ
数“2”、セクタ容量“1024”、アペンド番号
“1”である。また、ディレクトリD5は、先頭セクタ
アドレス“6”、セクタ数“1”、セクタ容量“17
6”、アペンド番号“2”である。次に、デバイスドラ
イバーはステップ303でドライブ31を制御し、光カ
ード1にディレクトリを記録してクローズ処理を終了す
る。
The directory D4 contains the original sectors S3, S
Information for managing the data of directory 4, directory D
Reference numeral 5 denotes management information for managing data in the sector S6 after the rewriting of the original sector S5. Directory D4
As shown in FIG. 8, the directory number is "4", the file name is "file B", the starting sector address is "3", the number of sectors is "2", the sector capacity is "1024", and the append number is "1". The directory D5 has a head sector address “6”, a sector number “1”, and a sector capacity “17”.
6 ”and append number“ 2. ”Next, the device driver controls the drive 31 in step 303 to record a directory on the optical card 1 and ends the close processing.

【0054】次に、光カード1をドライブ31から取り
出し、再びドライブ31にセットしてファイルBを読み
出す場合、同様にアプリケーションはfopen( )関数を用
いてファイルBをオープンし、このオープン要求に対
し、デバイスドライバーはワークメモリに読み込んでい
るディレクトリ(図8のディレクトリ)を検索し、指定
されたファイルBが光カード1に記録されているかどう
かを確認する。ファイルBは消去ディレクトリD3によ
って一旦擬似的に消去されているが、ファイルBに関し
てディレクトリD4〜D5が記録されているので、ファ
イルBのオープンを正常に行うことができる。
Next, when the optical card 1 is removed from the drive 31 and set in the drive 31 again to read the file B, the application similarly opens the file B using the fopen () function, and responds to the open request. The device driver searches the directory (the directory in FIG. 8) read into the work memory, and checks whether the specified file B is recorded on the optical card 1. Although the file B is once pseudo-erased by the erasure directory D3, since the directories D4 to D5 are recorded for the file B, the file B can be normally opened.

【0055】次いで、アプリケーションがファイルBを
読む場合、まず、最初の1024バイトはディレクトリ
D4に従って読み出す。即ち、デバイスドライバーはド
ライブ31を制御し、図8のディレクトリD4に従って
セクタS3、S4のデータを読み出し、アプリケーショ
ンに渡す。続いて、1025バイト目から1200バイ
ト目まではディレクトリD5に従ってセクタS6のデー
タを読み出し、アプリケーションに渡す。1201バイ
ト以降のデータの要求に対しては、どのディレクトリも
管理していないので、“End of Fie”というエラーコー
ドをアプリケーションに渡して、要求がエラーであるこ
とを通知する。以上でファイルBの読み出しを終了す
る。
Next, when the application reads the file B, first, the first 1024 bytes are read according to the directory D4. That is, the device driver controls the drive 31, reads the data in the sectors S3 and S4 according to the directory D4 in FIG. 8, and transfers the data to the application. Subsequently, from the 1025th byte to the 1200th byte, the data of the sector S6 is read out according to the directory D5 and passed to the application. Since no directory is managed for a request for data after 1201 bytes, an error code “End of Fie” is passed to the application to notify that the request is an error. Thus, the reading of the file B is completed.

【0056】次に、ファイルの2箇所のデータを書き換
える場合の書き換え方法について説明する。この場合
は、図9に示すように光カード1にファイルC(大きさ
2500バイト)、それを管理するためのディレクトリ
D1が記録されているものとする。図10はこのディレ
クトリD1を示している。また、書き換える領域として
は、ファイルCの先頭から600バイトのオフセット位
置から50バイトの大きさのデータ(以下、第1の領域
という)、及びファイルCの先頭から1900バイトの
オフセット位置から50バイトの大きさのデータ(以
下、第2の領域)を書き換えるものとする。
Next, a description will be given of a rewriting method for rewriting data at two locations in a file. In this case, it is assumed that a file C (2500 bytes in size) and a directory D1 for managing the file C are recorded on the optical card 1 as shown in FIG. FIG. 10 shows this directory D1. The area to be rewritten includes data having a size of 50 bytes from an offset position of 600 bytes from the beginning of the file C (hereinafter, referred to as a first area) and an area of 50 bytes from an offset position of 1900 bytes from the beginning of the file C. It is assumed that the size data (hereinafter, the second area) is rewritten.

【0057】ファイルCのデータを書き換える場合、同
様にアプリケーションはfopen( )関数を用いてファイル
Cをオープンし、デバイスドライバーはワークメモリに
ファイルCのエントリが存在するかを調べ、存在する場
合は、fopen( )関数の戻り値を正常を示す値に指定す
る。次に、アプリケーションは、第1の領域の書き換え
を行う。まず、書き換えるべき目的のアドレスまでファ
イルポインタを移動させるため、fseek( )関数を実行す
る。この場合、第1の領域は、ファイルCの先頭から6
00バイト目以降のデータを書き換えるので、whence引
数にファイルCの最初を示すパラメータを指定し、offs
et引数に600を指定する。続いて、アプリケーション
はfwrite( ) 関数に書き換えるべきデータ(50バイ
ト)を指定し、デバイスドライバーは同様にこのfwrite
( ) 関数に対して図2の記録処理を実行する。
When rewriting the data of file C, the application similarly opens file C using the fopen () function, and the device driver checks whether the entry of file C exists in the work memory. Specify the return value of the fopen () function as a value indicating normality. Next, the application rewrites the first area. First, the fseek () function is executed to move the file pointer to the target address to be rewritten. In this case, the first area is 6
Since the data after the 00th byte is rewritten, a parameter indicating the beginning of file C is specified in the whence argument, and offs
Specify 600 in the et argument. Next, the application specifies the data (50 bytes) to be rewritten to the fwrite () function, and the device driver similarly specifies the fwrite () function.
(2) Execute the recording process of FIG. 2 for the function.

【0058】まず、ステップ201で書き換え要求のあ
ったデータが記録されている開始セクタアドレスと終了
セクタアドレスを算出する。第1の領域において、書き
換えるデータのアドレスは600から649であるの
で、このアドレスを用いて同様に(1)、(2)式によ
って書き換えるべき開始セクタと終了セクタのアドレス
を算出する。書き換える開始セクタアドレスは、書き換
えるデータの先頭アドレスは600、セクタサイズは5
12、ファイルCの先頭セクタアドレスは0であるの
で、 開始セクタ=(600/512)+0=1 となる。また、終了セクタアドレスは書き換えるデータ
の終了アドレスは、649であるので、 終了セクタ=(649/512)+0=1 となる。
First, in step 201, the start sector address and the end sector address where the data requested to be rewritten are recorded are calculated. In the first area, since the address of the data to be rewritten is from 600 to 649, the addresses of the start sector and the end sector to be rewritten are similarly calculated by using the addresses according to the equations (1) and (2). The start sector address of the data to be rewritten is 600, the head address of the data to be rewritten is 5, and the sector size is 5.
12. Since the start sector address of file C is 0, the start sector = (600/512) + 0 = 1. Also, since the end address of the data to be rewritten is 649, the end sector = (649/512) + 0 = 1.

【0059】以上の結果から書き換える開始セクタアド
レス、終了セクタアドレスはともに1となり、デバイス
ドライバーはステップ202でこれに該当する光カード
1のセクタS1のデータを読み出し、バッファに格納す
る。次いで、デバイスドライバーは、ステップ203で
バッファに読み込んだデータを書き換え、ステップ20
4でドライブ31を制御してバッファのデータを光カー
ド1に記録する。この場合は、図9のように光カードに
セクタS4までファイルCのデータが記録されているの
で、セクタS5にバッファのデータを記録する。
From the above results, the start sector address and the end sector address to be rewritten are both 1. The device driver reads the data of the sector S1 of the optical card 1 corresponding to this at step 202 and stores it in the buffer. Next, the device driver rewrites the data read into the buffer in step 203, and
4 controls the drive 31 to record the buffer data on the optical card 1. In this case, since the data of the file C is recorded up to the sector S4 on the optical card as shown in FIG. 9, the data of the buffer is recorded in the sector S5.

【0060】続いて、アプリケーションは、第2の領域
の書き換えを行う。まず、書き換えるべき目的のアドレ
スまでファイルポインタを移動させるため、fseek( )関
数を実行する。第2の領域は、ファイルCの先頭から1
900バイト目以降のデータを書き換えるので、whence
引数にファイルCの最初を示すパラメータを指定し、of
fset引数に1900を指定する。次に、アプリケーショ
ンはfwrite( ) 関数に書き換えるべきデータ(50バイ
ト)を指定し、デバイスドライバーは同様にこのfwrite
( ) 関数に対して図2の記録処理を実行する。
Subsequently, the application rewrites the second area. First, the fseek () function is executed to move the file pointer to the target address to be rewritten. The second area is 1 from the beginning of file C.
Since the data after the 900th byte is rewritten,
Specify the parameter indicating the beginning of file C in the argument, and
Specify 1900 in the fset argument. Next, the application specifies the data (50 bytes) to be rewritten to the fwrite () function, and the device driver similarly specifies the fwrite () function.
(2) Execute the recording process of FIG. 2 for the function.

【0061】まず、ステップ201で書き換え要求のあ
ったデータが記録されている開始セクタアドレスと終了
セクタアドレスを算出する。第2の領域において、書き
換えるデータのアドレスは1900から1949である
ので、このアドレスを用いて同様に(1)、(2)式に
よって書き換えるべき開始セクタと終了セクタのアドレ
スを算出する。書き換える開始セクタアドレスは、書き
換えるデータの先頭アドレスは1900、セクタサイズ
は512、ファイルCの先頭セクタアドレスは0である
ので、 開始セクタ=(1900/512)+0=3 となる。また、終了セクタアドレスは書き換えるデータ
の終了アドレスは、1949であるので、 終了セクタ=(1949/512)+0=3 となる。
First, in step 201, a start sector address and an end sector address where data requested to be rewritten are recorded are calculated. In the second area, since the address of the data to be rewritten is from 1900 to 1949, the addresses of the start sector and the end sector to be rewritten are similarly calculated by using the addresses according to the equations (1) and (2). The start sector address to be rewritten is 1900, the sector size is 512, the start sector address of the file C is 0, and the start sector = (1900/512) + 0 = 3. Since the end address of the data to be rewritten is 1949, the end sector address is (1949/512) + 0 = 3.

【0062】以上の結果から書き換える開始セクタアド
レス、終了セクタアドレスはともに3となり、デバイス
ドライバーはステップ202でこれに該当する光カード
1のセクタS3のデータを読み出し、バッファに格納す
る。次いで、デバイスドライバーは、ステップ203で
バッファに読み込んだデータを書き換え、ステップ20
4でバッファのデータを光カード1に記録する。この場
合は、図9のように第1の領域の書き換えによってセク
タS5まで記録済であるので、セクタS6にバッファの
データを記録する。
From the above result, the start sector address and the end sector address to be rewritten are both 3. The device driver reads the data of the sector S3 of the optical card 1 corresponding to this at step 202 and stores it in the buffer. Next, the device driver rewrites the data read into the buffer in step 203, and
In step 4, the data in the buffer is recorded on the optical card 1. In this case, as shown in FIG. 9, since the data up to the sector S5 has been recorded by rewriting the first area, the buffer data is recorded in the sector S6.

【0063】次に、アプリケーションからfclose( ) 関
数によるクローズ要求が発行されると、デバイスドライ
バーは同様に図3の処理を実行する。まず、ステップ3
01で消去ディレクトリD2を記録し、書き換え対象の
ファイルCを擬似的に消去する。消去ディレクトリD2
を図10に示している。同様に消去ディレクトリD2の
消去フラグを“1”としている。次に、ステップ302
で書き換え後のファイルCを管理するための管理情報を
作成する。この場合は、図10に示すように5つのディ
レクトリD3〜D7を作成する。
Next, when a close request by the fclose () function is issued from the application, the device driver similarly executes the processing of FIG. First, step 3
At 01, the erasure directory D2 is recorded, and the file C to be rewritten is artificially erased. Erase directory D2
Is shown in FIG. Similarly, the erase flag of the erase directory D2 is set to "1". Next, step 302
To create management information for managing the rewritten file C. In this case, five directories D3 to D7 are created as shown in FIG.

【0064】ディレクトリD3はセクタS0のデータを
管理するための管理情報、ディレクトリD4はもとのセ
クタS1を書き換えた後のセクタS5のデータを管理す
るための管理情報、ディレクトリD5はセクタS2のデ
ータを管理するための管理情報、ディレクトリD6はも
とのセクタS3を書き換えた後のセクタS6のデータを
管理するための管理情報、ディレクトリD7はセクタS
4を管理するための管理情報である。ディレクトリD3
〜D7の詳細を図10に示している。ディレクトリD4
とD6は前述のように書き換え後のセクタのデータを管
理するための管理情報で、先頭セクタアドレスはそれぞ
れ“5”、“6”である。このように管理情報を作成す
ると、デバイスドライバーはステップ303で光カード
1にディレクトリを記録してクローズ処理を終了する。
図9において、D2〜D7はクローズ処理によって記録
されたディレクトリ、セクタS5、S6は書き換えによ
って記録されたデータである。
The directory D3 is management information for managing data of the sector S0, the directory D4 is management information for managing data of the sector S5 after rewriting the original sector S1, and the directory D5 is the data of the sector S2. Directory D6 is management information for managing data in sector S6 after rewriting original sector S3, and directory D7 is sector S
4 is management information for managing No. 4. Directory D3
Details of D7 are shown in FIG. Directory D4
And D6 are management information for managing the data of the rewritten sector as described above, and the leading sector addresses are "5" and "6", respectively. When the management information is created in this way, the device driver records the directory on the optical card 1 in step 303 and ends the closing process.
In FIG. 9, D2 to D7 are directories recorded by the close process, and sectors S5 and S6 are data recorded by rewriting.

【0065】次に、図9の光カード1をドライブ31か
ら取り出し、再びドライブ31にセットしてファイルC
を読み出す場合、同様にアプリケーションはfopen( )関
数を用いてファイルCをオープンし、このオープン要求
に対し、デバイスドライバーはワークメモリに読み込ん
でいるディレクトリ(図10のディレクトリ)を検索
し、指定されたファイルCが光カード1に記録されてい
るかどうかを確認する。ファイルCは消去ディレクトリ
D2によって一旦擬似的に消去されているが、ファイル
Cに関してディレクトリD3〜D7が記録されているの
で、ファイルCのオープンを正常に行うことができる。
Next, the optical card 1 shown in FIG.
Similarly, when reading the file, the application opens the file C using the fopen () function, and in response to this open request, the device driver searches the directory (the directory in FIG. 10) read into the work memory and specifies the specified file. It is confirmed whether or not the file C is recorded on the optical card 1. Although the file C is once pseudo-erased by the erasure directory D2, since the directories D3 to D7 are recorded for the file C, the file C can be normally opened.

【0066】次いで、アプリケーションがファイルC
(大きさ2500バイト)を読み出す場合、まず、最初
の512バイトは図10のディレクトリD3に従ってセ
クタS0のデータを読み出し、513バイト目以降10
24バイト目まではディレクトリD4に従ってセクタS
5のデータを読み出し、1025バイト目以降1536
バイト目まではディレクトリD5に従ってセクタS2の
データを読み出し、アプリケーションに渡す。また、1
537バイト目以降2048バイト目まではディレクト
リD6に従ってセクタ6のデータを読み出し、2049
バイト目以降2500バイト目まではディレクトリD7
に従ってセクタS4のデータを読み出し、アプリケーシ
ョンに渡す。2501バイト以降のデータの要求に対し
ては、どのディレクトリも管理していないので、“End
of Fie”というエラーコードをアプリケーションに渡し
て、要求がエラーであることを通知する。以上でファイ
ルCの読み出しを終了する。
Next, the application sets the file C
(2500 bytes in size), the first 512 bytes are read from the data in the sector S0 according to the directory D3 in FIG.
Up to the 24th byte, sector S according to directory D4
5 data is read and 1536 bytes after the 1,025th byte
Up to the byte, the data in the sector S2 is read according to the directory D5 and passed to the application. Also, 1
From the 537th byte to the 2048th byte, the data of sector 6 is read according to directory D6, and 2049 is read.
The directory D7 from the byte to the 2500th byte
The data of the sector S4 is read out according to the above and transferred to the application. Since no directory is managed for a request for data after 2501 bytes, "End
An error code “of Fie” is passed to the application to notify that the request is an error.

【0067】次に、本発明の第2の実施形態について説
明する。先の実施形態では書き換えるセクタアドレスを
(1)、(2)式を用いて算出したが、本実施形態では
書き換えるセクタアドレスをディレクトリに基づいて求
めている。なお、本実施形態では、図6の光カード1の
ファイルBのデータを書き換えるものとし、図6の光カ
ードは前述のようにファイルBの一部のデータを書き換
えている。また、図8は光カードに記録されたディレク
トリD1〜D5である。この光カードがドライブ31に
セットされ、デバイスドライバーのワークメモリには光
カードのすべてのディレクトリD1〜D5が読み込まれ
ているものとする。なお、この場合は、ファイルBの先
頭から1100バイトのオフセット位置から50バイト
のデータを書き換えるものとする。
Next, a second embodiment of the present invention will be described. In the previous embodiment, the sector address to be rewritten was calculated by using equations (1) and (2). In the present embodiment, the sector address to be rewritten is obtained based on the directory. In this embodiment, it is assumed that the data of the file B of the optical card 1 of FIG. 6 is rewritten, and the optical card of FIG. 6 partially rewrites the data of the file B as described above. FIG. 8 shows directories D1 to D5 recorded on the optical card. It is assumed that this optical card is set in the drive 31 and all directories D1 to D5 of the optical card have been read into the work memory of the device driver. In this case, it is assumed that 50 bytes of data are rewritten from the offset position of 1100 bytes from the beginning of file B.

【0068】ファイルBの一部のデータを書き換える場
合、アプリケーションはfopen( )関数を用いてファイル
Bをオープンし、デバイスドライバーはワークメモリに
ファイルBのエントリが存在するかを調べ、存在する場
合は、fopen( )関数の戻り値を正常を示す値に指定す
る。また、アプリケーションは書き換えるべき目的のア
ドレスまでファイルポインタを移動させるため、fseek
( )関数を実行する。この場合は、ファイルBの先頭か
ら1100バイト目以降のデータを書き換えるのでwhen
ce引数にファイルBの最初を示すパラメータを指定し、
offset引数に1100を指定する。続いて、アプリケー
ションはfwrite( ) 関数に書き換えるべきデータ(50
バイト)を指定し、デバイスドライバーは同様にこのfw
rite( ) 関数に対して図2の処理を実行する。
When rewriting a part of the data of the file B, the application opens the file B by using the fopen () function, and the device driver checks whether the entry of the file B exists in the work memory. Specify the return value of the fopen () function as a value indicating normality. Also, since the application moves the file pointer to the target address to be rewritten, fseek
Execute the () function. In this case, since the data after the 1100th byte from the beginning of file B is rewritten,
Specify the parameter indicating the beginning of file B in the ce argument,
Specify 1100 for the offset argument. Subsequently, the application writes the data to be rewritten to the fwrite () function (50
Byte), and the device driver also
The processing of FIG. 2 is executed for the rite () function.

【0069】まず、ステップ201でアプリケーション
から書き換え要求のあったデータが記録されているセク
タアドレスを求める処理を行う。本実施形態では、書き
換えるデータのアドレスは1100から1149である
ので、このアドレスとディレクトリをもとにセクタアド
レスを求める。具体的には、まず、図8のファイルBを
管理するディレクトリのうち最初のディレクトリD4の
管理領域に、書き換えるデータのアドレスが含まれてい
るかどうかを判断する。ディレクトリD4の管理する領
域は、ファイルBの全領域のうちのアドレス0からアド
レス1023までの領域である。従って、書き換えるデ
ータのアドレスは含まれておらず、2番目のディレクト
リD5の管理領域に同様に書き換えるデータのアドレス
が含まれているかどうかを判断する。
First, in step 201, a process for obtaining a sector address in which data requested to be rewritten by an application is recorded is performed. In this embodiment, since the address of the data to be rewritten is from 1100 to 1149, the sector address is obtained based on this address and the directory. Specifically, first, it is determined whether or not the address of the data to be rewritten is included in the management area of the first directory D4 among the directories for managing the file B in FIG. The area managed by the directory D4 is an area from address 0 to address 1023 of the entire area of the file B. Therefore, it is determined whether the address of the data to be rewritten is not included and the address of the data to be rewritten is also included in the management area of the second directory D5.

【0070】ディレクトリD5の管理領域は、ファイル
Bのアドレス1024からアドレス1199までの領域
であるので、書き換えるデータのアドレスを含んでお
り、また、このディレクトリD5は1個のセクタのみを
管理しているので、書き換えの対象となるデータはアド
レス6、即ち、セクタS6であることがわかる。このよ
うにして書き換え対象のセクタが求まると、デバイスド
ライバーはステップ202で光カードのデータをバッフ
ァに読み込み、ステップ203でバッファのデータを書
き換え、ステップ204でバッファのデータを光カード
に記録する。この場合は、光カードはセクタS6まで記
録済であるので、図11に示すようにセクタS7に記録
する。
Since the management area of the directory D5 is an area from the address 1024 to the address 1199 of the file B, it contains the address of the data to be rewritten, and the directory D5 manages only one sector. Therefore, it can be seen that the data to be rewritten is the address 6, that is, the sector S6. When the sector to be rewritten is thus obtained, the device driver reads the data of the optical card into the buffer in step 202, rewrites the data in the buffer in step 203, and records the data in the buffer on the optical card in step 204. In this case, since the optical card has been recorded up to the sector S6, it is recorded in the sector S7 as shown in FIG.

【0071】次に、アプリケーションからfclose( ) 関
数によるクローズ要求が発行されると、デバイスドライ
バーは同様に図3の処理を実行する。まず、ステップ3
01で消去ディレクトリD6を記録し、書き換え対象の
ファイルBを擬似的に消去する。消去ディレクトリD6
は、図12に示すように消去フラグを“1”としてい
る。次に、ステップ302で書き換え後のファイルBを
管理するための管理情報を作成する。この場合は、図1
2に示すように2つのディレクトリD7、D8を作成す
る。
Next, when a close request by the fclose () function is issued from the application, the device driver similarly executes the processing of FIG. First, step 3
At 01, the erasure directory D6 is recorded, and the file B to be rewritten is artificially erased. Erase directory D6
Sets the erase flag to "1" as shown in FIG. Next, in step 302, management information for managing the rewritten file B is created. In this case, FIG.
2, two directories D7 and D8 are created.

【0072】ディレクトリD7はファイルBのセクタS
3、S4のデータを管理するための管理情報、ディレク
トリD8はもとのセクタS6を書き換えた後のセクタS
7のデータを管理するための管理情報である。ディレク
トリD7、D8の詳細を図12に示している。このよう
にして管理情報を作成すると、デバイスドライバーはス
テップ303で光カード1にディレクトリを記録して、
クローズ処理を終了する。図11において、D6〜D8
はクローズ処理によって記録されたディレクトリであ
る。
The directory D7 is the sector S of the file B.
3, management information for managing the data of S4, the directory D8 is the sector S after rewriting the original sector S6.
7 is management information for managing the data of No. 7. FIG. 12 shows the details of the directories D7 and D8. When the management information is created in this manner, the device driver records a directory on the optical card 1 in step 303, and
The closing process ends. In FIG. 11, D6 to D8
Is a directory recorded by the close processing.

【0073】次に、図11の光カードをドライブ31か
ら取り出し、再びドライブ31にセットしてファイルB
を読み出す場合、同様にアプリケーションはfopen( )関
数を用いてファイルBをオープンし、このオープン要求
に対し、デバイスドライバーはワークメモリに読み込ん
でいるディレクトリ(図12のディレクトリ)を検索
し、指定されたファイルCが光カード1に記録されてい
るかどうかを確認する。ファイルBは消去ディレクトリ
D6によって一旦擬似的に消去されているが、ファイル
Bに関してディレクトリD7、D8が記録されているの
で、ファイルBのオープンを正常に行うことができる。
Next, the optical card shown in FIG.
Similarly, the application opens the file B by using the fopen () function, and in response to the open request, the device driver searches the directory (the directory in FIG. 12) read into the work memory and specifies the specified file. It is confirmed whether or not the file C is recorded on the optical card 1. Although the file B is once pseudo-erased by the erasure directory D6, since the directories D7 and D8 are recorded for the file B, the file B can be normally opened.

【0074】次いで、アプリケーションがファイルB
(大きさ1200バイト)を読み出す場合、まず、最初
の1024バイトは図12のディレクトリD7に従って
セクタS3、S4のデータを読み出し、1025バイト
目以降1200バイト目まではディレクトリD8に従っ
てセクタS7のデータを読み出し、アプリケーションに
渡す。また、1201バイト以降のデータの要求に対し
ては、どのディレクトリも管理していないので、“End
of Fie”というエラーコードをアプリケーションに渡し
て、要求がエラーであることを通知する。以上でファイ
ルBの読み出しを終了する。
Next, the application sets the file B
When reading (1200 bytes in size), the first 1024 bytes read the data of the sectors S3 and S4 according to the directory D7 in FIG. 12, and the 1025th byte to the 1200th byte read the data of the sector S7 according to the directory D8. Pass to the application. In addition, since no directory is managed for a request for data after 1201 bytes, "End
The error code "of Fie" is passed to the application to notify that the request is an error, and the reading of the file B is completed.

【0075】[0075]

【発明の効果】以上説明したように本発明によれば、記
録媒体に記録されたファイルのうち書き換えるべきデー
タを含んでいるセクタのみを追記することにより、すべ
てのファイルを別の位置に記録する従来方法に比べて、
処理速度を短縮できるばかりでなく、記録容量を大幅に
節約することができる。従って、ファイルサイズが大き
いほど記録媒体の容量が低下することがなく、効果的に
情報を書き換えることができる。また、従来の再生方法
を変更する必要はなく、従来の再生方法をそのまま用い
ることができる。
As described above, according to the present invention, all the files are recorded at different positions by additionally writing only the sector containing the data to be rewritten among the files recorded on the recording medium. Compared to the conventional method,
Not only can the processing speed be reduced, but also the recording capacity can be greatly reduced. Therefore, as the file size increases, the capacity of the recording medium does not decrease and information can be rewritten effectively. Further, there is no need to change the conventional reproducing method, and the conventional reproducing method can be used as it is.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明の第1の実施形態に係るホストコンピュ
ータとドライブからなるシステムの構成例を示したブロ
ック図である。
FIG. 1 is a block diagram illustrating a configuration example of a system including a host computer and a drive according to a first embodiment of the present invention.

【図2】本発明の第1の実施形態によるファイルの書き
換え方法を説明するためのフローチャートである。
FIG. 2 is a flowchart for explaining a file rewriting method according to the first embodiment of the present invention.

【図3】本発明の第1の実施形態によるファイルのクロ
ーズ処理を説明するためのフローチャートである。
FIG. 3 is a flowchart illustrating a file closing process according to the first embodiment of the present invention.

【図4】光カードに記録されたファイルのセクタのうち
中央のセクタを書き換える場合の光カードを示した図で
ある。
FIG. 4 is a diagram showing an optical card in the case where a central sector among sectors of a file recorded on the optical card is rewritten.

【図5】図4のファイルの書き換えに際して記録される
ディレクトリの内容を示した図である。
FIG. 5 is a diagram showing contents of a directory recorded when rewriting the file of FIG. 4;

【図6】光カードに記録されたファイルのセクタのうち
先頭のセクタを書き換える場合の光カードを示した図で
ある。
FIG. 6 is a diagram showing an optical card in the case of rewriting a first sector among sectors of a file recorded on the optical card.

【図7】図6のファイルの書き換えに際して記録される
ディレクトリの内容を示した図である。
7 is a diagram showing the contents of a directory recorded when rewriting the file of FIG. 6;

【図8】光カードに記録されたファイルのうち最後のセ
クタを書き換える場合のディレクトリの内容を示した図
である。
FIG. 8 is a diagram showing the contents of a directory when the last sector of a file recorded on an optical card is rewritten.

【図9】光カードに記録されたファイルのうち2箇所の
データを書き換える場合の光カードを示した図である。
FIG. 9 is a diagram showing an optical card in the case of rewriting data at two locations in a file recorded on the optical card.

【図10】図9の光カードの書き換えに際して記録され
るディレクトリの内容を示した図である。
FIG. 10 is a diagram showing the contents of a directory recorded when rewriting the optical card of FIG. 9;

【図11】本発明の第2の実施形態による図6の一度書
き換えたファイルを再度書き換える場合の光カードを示
した図である。
FIG. 11 is a diagram showing an optical card when rewriting the once rewritten file of FIG. 6 according to the second embodiment of the present invention.

【図12】図11の光カードの書き換えに際して記録さ
れるディレクトリの内容を示した図である。
FIG. 12 is a diagram showing the contents of a directory recorded when rewriting the optical card of FIG. 11;

【図13】従来のファイルが記録された光カードを示し
た図である。
FIG. 13 is a diagram showing an optical card on which a conventional file is recorded.

【図14】図13の光カードのディレクトリの内容を示
した図である。
FIG. 14 is a diagram showing the contents of a directory of the optical card of FIG. 13;

【図15】従来の情報記録方法を説明するためのフロー
チャートである。
FIG. 15 is a flowchart for explaining a conventional information recording method.

【図16】従来のファイルの書き換え方法を説明するた
めの図である。
FIG. 16 is a diagram for explaining a conventional file rewriting method.

【図17】図16のファイルの書き換えに際して記録さ
れるディレクトリの内容を示した図である。
17 is a diagram showing the contents of a directory recorded when rewriting the file of FIG. 16;

【符号の説明】[Explanation of symbols]

1 光カード 31 情報記録再生装置(ドライブ) 32 ホストコンピュータ 33 MPU 38 光ビーム照射光学系 39 光検出器 50 光ヘッド D1〜D8 ディレクトリ S0〜S7 セクタ Reference Signs List 1 optical card 31 information recording / reproducing device (drive) 32 host computer 33 MPU 38 light beam irradiation optical system 39 photodetector 50 optical head D1 to D8 directory S0 to S7 sector

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】 追記型記録媒体に記録されている書換対
象のファイルデータのうち書き換えるべきデータを含ん
でいるセクタアドレスを求めるステップと、前記セクタ
アドレスの書き換えるデータを作成するステップと、作
成されたデータを前記記録媒体に追記するステップと、
書換対象のファイルを擬似的に消去するディレトクリを
前記記録媒体に記録するステップと、書き換え後のファ
イルを管理するためのディレクトリを作成し、前記記録
媒体に記録するステップとを有することを特徴とする情
報記録方法。
1. A step of obtaining a sector address including data to be rewritten among file data to be rewritten recorded on a write-once recording medium, a step of creating data for rewriting the sector address, Appending data to the recording medium;
Recording a directory for artificially erasing a file to be rewritten on the recording medium, and creating a directory for managing the rewritten file and recording the directory on the recording medium. Information recording method.
【請求項2】 前記書き換えるべきデータを含んでいる
セクタアドレスのうち先頭セクタアドレスを、(書き換
えるデータの先頭アドレス/セクタサイズ)+書換対象
のファイルの先頭セクタアドレスによって算出し、最終
セクタアドレスを、(書き換えるデータの最終アドレス
/セクタサイズ)+書換対象のファイルの先頭セクタア
ドレスによって算出することを特徴とする請求項1に記
載の情報記録方法。
2. A head sector address of a sector address including data to be rewritten is calculated by (head address of data to be rewritten / sector size) + a head sector address of a file to be rewritten, and a last sector address is calculated. 2. The information recording method according to claim 1, wherein the calculation is performed by (final address of data to be rewritten / sector size) + first sector address of a file to be rewritten.
【請求項3】 前記書き換えるべきデータを含んでいる
セクタアドレスを、書き換えるデータのアドレス、及び
書換対象のファイルを管理するディレクトリに基づいて
求めることを特徴とする請求項1に記載の情報記録方
法。
3. The information recording method according to claim 1, wherein a sector address including the data to be rewritten is obtained based on an address of the data to be rewritten and a directory for managing a file to be rewritten.
【請求項4】 前記書き換え後のファイルを管理するデ
ィレクトリは、書換対象のファイルのうち書き換えたセ
クタのデータを管理するディレクトリ、及び書き換えた
以外のセクタのデータを管理するディレクトリからなる
ことを特徴とする請求項1に記載の情報記録方法。
4. The directory for managing a rewritten file includes a directory for managing data of a rewritten sector in a file to be rewritten, and a directory for managing data of a sector other than the rewritten sector. 2. The information recording method according to claim 1, wherein:
【請求項5】 前記記録媒体は、光カードであることを
特徴とする請求項1に記載の情報記録方法。
5. The information recording method according to claim 1, wherein the recording medium is an optical card.
JP9178121A 1997-07-03 1997-07-03 Information recording method Pending JPH1124979A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP9178121A JPH1124979A (en) 1997-07-03 1997-07-03 Information recording method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP9178121A JPH1124979A (en) 1997-07-03 1997-07-03 Information recording method

Publications (1)

Publication Number Publication Date
JPH1124979A true JPH1124979A (en) 1999-01-29

Family

ID=16043027

Family Applications (1)

Application Number Title Priority Date Filing Date
JP9178121A Pending JPH1124979A (en) 1997-07-03 1997-07-03 Information recording method

Country Status (1)

Country Link
JP (1) JPH1124979A (en)

Similar Documents

Publication Publication Date Title
JP4300669B2 (en) Recording method and apparatus, and recording medium
JP4285375B2 (en) Recording / reproducing apparatus, recording / reproducing method, and program
US6732192B2 (en) Disc recording scheme for enabling quick access to disc data
EP0461831B1 (en) Method for changing a file name of a directory in a non-rewritable record medium
JPH1083658A (en) Recording device and recording medium
US7016293B2 (en) Method of overwriting data in a multi-session disk
JPH0778984B2 (en) Recording / reproducing apparatus for optical recording medium
JPH1124979A (en) Information recording method
JP2003173285A (en) Information recording method and information record reproduction device
JPH03217972A (en) File retrieving device
JPH10302397A (en) Optical disk recording device
JP2597451B2 (en) Information recording and playback method
JP2982923B2 (en) File management method
JP3707396B2 (en) Recording method and recording apparatus
JP2612589B2 (en) Directory search method
JPH01236488A (en) Rewritable type optical disk control system
JPS6134773A (en) Information recording system
JPH10283245A (en) Information recording method
JP2002269746A (en) Data recording method and device
JP3562486B2 (en) Recording method, recording apparatus, and recording medium
JP3707400B2 (en) Recording method and recording apparatus
JPH05342817A (en) File management method and information recording and reproducing device
JP2001154900A (en) Information recording device
JPS61153875A (en) Optical information recording and reproducing device
JPH02132516A (en) System and method for write enable type optical disk controlling