WO2013140516A1 - Recording method, recording device, and recording program - Google Patents

Recording method, recording device, and recording program Download PDF

Info

Publication number
WO2013140516A1
WO2013140516A1 PCT/JP2012/057062 JP2012057062W WO2013140516A1 WO 2013140516 A1 WO2013140516 A1 WO 2013140516A1 JP 2012057062 W JP2012057062 W JP 2012057062W WO 2013140516 A1 WO2013140516 A1 WO 2013140516A1
Authority
WO
WIPO (PCT)
Prior art keywords
recording
data
data set
record
data length
Prior art date
Application number
PCT/JP2012/057062
Other languages
French (fr)
Japanese (ja)
Inventor
景扶 秋田
Original Assignee
富士通株式会社
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 富士通株式会社 filed Critical 富士通株式会社
Priority to PCT/JP2012/057062 priority Critical patent/WO2013140516A1/en
Publication of WO2013140516A1 publication Critical patent/WO2013140516A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • G11B20/12Formatting, e.g. arrangement of data block or words on the record carriers
    • G11B20/1217Formatting, e.g. arrangement of data block or words on the record carriers on discs

Definitions

  • This case relates to a recording method, a recording apparatus, and a recording program.
  • the process of sequentially recording variable length data in a storage device is widely performed in various applications. For example, when executing a program or operating a device, log information of the program or device is recorded in a storage device. Such operation log information of the program and apparatus is indispensable when performing analysis when a failure occurs.
  • variable-length data may be referred to as “variable-length record”.
  • an operation log is recorded in a nonvolatile memory.
  • an object of the present invention is to provide a technique for sequentially recording variable length data in a storage area of a nonvolatile storage device.
  • the processing device has the variable length data and the variable data respectively from the first recording position to the second recording position in the storage area of the recording device.
  • the first recording position indicates the data length of the long data, sequentially records a data set including front and rear data length information recorded in front and rear of the variable length data, and the remaining recording area is insufficient.
  • the second recording position is changed to the first recording position in a state where the recorded data is overwritten with a new data set from the first recording position toward the second recording position.
  • this recording apparatus is a recording apparatus having a storage area, and variable length data and each variable length from the first recording position to the second recording position in the storage area of the recording apparatus.
  • a data set that indicates the data length of the data and sequentially records a data set including forward and backward data length information recorded in front and rear of the variable-length data, and is recorded at the first recording position according to the occurrence of a shortage of the remaining recording area. Returning from the first recording position to the second recording position, the recorded data is overwritten with a new data set, and then the second recording position is directed to the first recording position.
  • the recording program is a recording program for causing a computer to record data on the recording device.
  • the recording program causes the computer to move from a first recording position to a second recording position in a storage area of the recording device.
  • the variable length data and the data length of the variable length data are respectively indicated, the data set including the front and rear data length information recorded in front and rear of the variable length data is sequentially recorded, and the remaining recording area is insufficient. Accordingly, the second recording position is returned to the first recording position and the recorded data is overwritten with a new data set from the first recording position to the second recording position.
  • a data set in which forward data length information corresponding to the recording position of the forward data length information obtained from backward data length information from the position to the first recording position exists is continuous.
  • the first recording area to be found is specified, and the backward data length information corresponding to the recording position of the backward data length information obtained from the forward data length information from the first recording position toward the second recording position is An existing data set that does not reach the first recording area but is used as the recording start position of the next data set following the data set recorded at the position closest to the first recording area To execute the process.
  • variable length record recording method nonvolatile storage device, and variable length record recording program
  • the new data write start position and the read start position of data written in the nonvolatile storage device are determined from the nonvolatile storage device itself. Can be identified. For this reason, it is possible to sequentially record variable-length records in the storage area of the nonvolatile storage device.
  • FIG. 1 is a schematic diagram illustrating a hardware configuration of a system control unit 1 as an example of the first embodiment.
  • the system control unit (recording device) 1 is, for example, an information processing device or the like, and includes a CPU (Central Processing Unit) 5, a RAM (Random Access Memory) 7, and a nonvolatile memory 9.
  • the CPU 5 is a processor that reads a program from the RAM 7 and the nonvolatile memory 9 and executes processing as a variable-length record recording unit 3 described later.
  • a RAM (volatile storage device) 7 is a volatile memory that temporarily stores various data and programs when the CPU 5 performs calculations and controls.
  • the RAM 7 also stores temporary data (not shown) used by the variable length record recording unit 3.
  • the nonvolatile memory (nonvolatile storage device) 9 is a nonvolatile writable memory including a storage area 61 for storing data.
  • the nonvolatile memory 9 is, for example, an EPROM (Erasable Programmable ROM), an EEPROM (Electrically Programmable ROM), a UV-EPROM (Ultra-Violet Programmable Programmable ROM), or the like.
  • the nonvolatile memory 9 may be another writable nonvolatile memory such as a flash memory.
  • front means a direction in which the address value of the nonvolatile memory 9 decreases
  • backward means a direction in which the address value of the nonvolatile memory 9 increases.
  • head of the nonvolatile memory 9 means the minimum address area of the nonvolatile memory 9, and the tail or tail means the maximum address area.
  • present embodiment is not limited to this, and the present embodiment can be implemented with appropriate modifications.
  • the nonvolatile memory 9 has a storage area 61, and the storage area 61 has a data combination flag 115 (see FIG. 4) at the head.
  • the data combination flag 115 is set by the data combination flag setting unit 41 as described later with reference to FIG.
  • the variable-length record recording unit 3 receives data from a control program 93 executed by the CPU 3 or an operating system (OS) (not shown), and sequentially records this data in the storage area 61 of the nonvolatile memory 9. . At that time, the variable-length record recording unit 3 uses the record structure (data set) 100 described with reference to FIG. 2 to store data uniformly so that data writing is not concentrated on a specific part of the storage area 61. To do.
  • FIG. 2 is a diagram illustrating a record structure (data set) 100 used in the system control unit 1 as an example of the first embodiment.
  • Variable length data having this record structure 100 is stored in the storage area 61 of the nonvolatile memory 9 by the variable length record recording unit 3.
  • the record structure 100 shown in FIG. 2 includes a head flag 101, a forward data length (forward data length information, also called data length 1) 103, a rotation flag 105, overlapping position information 107, a data portion 109, a tail flag 111, and a rear It has a data length 113 (rear data length information, also called data length 2).
  • a record refers to one unit of data having the record structure 100.
  • the head flag 101 is a flag indicating the head of the record structure 100. In this example, for example, a value “0” is set.
  • the start flag 101 is, for example, 1 bit long.
  • the front data length 103 is a portion indicating the length of the data portion 109, and the same value as the rear data length 113 described later is set here.
  • the forward data length 103 is, for example, 7 bits long.
  • the head flag 101 and the forward data length 103 occupy 1 byte, and are collectively referred to as a first header byte 123.
  • the rotation flag 105 indicates that this record is a record written in the previous rotation (hereinafter referred to as the old record or the previous record) or a record written in the current rotation (hereinafter referred to as the new record or the current record). This is used to determine whether Here, the rotation refers to one sequential write from the beginning to the end of the storage area 61.
  • the rotation flag 105 is, for example, 1 bit long. In order to distinguish between the previous rotation record and the current rotation record, values “0” and “1” are alternately set in the rotation flag 105 for each rotation.
  • FIG. 3 is a diagram illustrating a method of using overlapping position information in an example of the first embodiment.
  • data bytes are expressed in hexadecimal.
  • the position of 1 byte in the new data section 109 to be written matches the position of the forward data length 103 of the old record, and this byte (hereinafter also referred to as a duplicate byte) has the same value as the forward data length 103 of the old record.
  • the duplication position information generation unit 43 to be described later reverses the bit “0x04” of the second byte of the data unit 109 of the new record to “0xFB”. Further, the duplication position information generation unit 43 sets a value “2” that is the bit position (second byte in this example) of the data portion 109 with the bit inverted in the duplication position information 107.
  • the data byte of the new data portion 109 to be written is compared with the first header byte 123 (first flag 101 + forward data length 103) of the old record. Since “0” is set, the forward data length 103 can be considered. Therefore, the byte position match is described as “the position of 1 byte in the new data portion 109 to be written matches the position of the forward data length 103”. In addition, the coincidence between the value of the duplicate byte and the first header byte 123 of the old record is described as “the duplicate byte and the forward data length 103 of the old record have the same value”.
  • the overlapping position information 107 is, for example, 7 bits long.
  • the rotation flag 105 and the overlapping position information 107 occupy 1 byte, and are collectively referred to as a second header byte 125.
  • the first header byte 123 and the second header byte 125 are collectively referred to as a header portion 121.
  • the data portion 109 is a variable length portion that stores data contents.
  • the data portion 109 is, for example, 1 to 127 bytes long.
  • the tail flag 111 is a flag indicating the end of data, and a value different from the head flag 101, for example, a value “1” is set.
  • the tail flag 111 is, for example, 1 bit long. As will be described later with reference to the example (6) in FIG. 6, this flag indicates that the old / old data boundary determination error occurs when the front data length 103 of the old record and the rear data length 113 of the new record overlap. Used to prevent.
  • the rear data length 113 is a portion indicating the length of the data portion 109, and here, the same value as that of the front data length 103 is set.
  • the backward data length 113 is, for example, 7 bits long.
  • the tail flag 111 and the backward data length 113 occupy 1 byte, and are collectively referred to as a footer unit 127.
  • the data length information is provided as the front data length 103 at the head of the data, and the rear data length 113 is also provided behind the data. It is arranged.
  • the minimum length of the data structure 100 illustrated in FIG. 2 is 4 bytes when the length of the data portion 109 is 1 byte.
  • the variable-length record recording unit 3 writes data in the storage area 61 in units of this record structure 100. Further, as shown in FIG. 4, the variable-length record recording unit 3 stores a data combination flag 115 in the first 1 byte of the storage area 61 of the nonvolatile memory 9, for example.
  • the data combination flag 115 itself is 1-bit information, and “0” is padded to the remaining 7 bits.
  • the data combination flag 115 is a flag indicating that the data is divided into two parts and stored across the end and the head of the storage area 61 because the data does not completely enter the remaining area at the end of the storage area 61. is there.
  • the value “1” is set in the data combination flag 115.
  • the variable-length record recording unit 3 adds the header part 121 and the footer part 127 to each of the divided data, generates two records, and writes them at the end and the top of the storage area 61, respectively. This division processing will be described later with reference to FIG.
  • FIG. 4 is a schematic diagram illustrating a functional configuration of the system control unit 1 as an example of the first embodiment.
  • the RAM 7 includes an overwrite position storage unit 51, a temporary record storage unit 53, and a rotation flag storage unit 55.
  • the overwrite position storage unit 51 is an area for storing an overwrite position described later.
  • the temporary record storage unit 53 is an area temporarily used when data is written to the storage unit 61 of the nonvolatile memory 9.
  • the rotation flag storage unit 55 is an area for storing a value set in the rotation flag 107 (see FIG. 2).
  • the CPU 5 is a processing device that realizes the variable-length record recording unit 3 by executing a variable-length record recording program (not shown) stored in the RAM 7 or the like.
  • the variable-length record recording unit 3 includes an oldest record specifying unit 11, a latest record specifying unit 13, a writing unit 15, and a reading unit 17.
  • the oldest record specifying unit 11 traces the storage area 61 of the nonvolatile memory 9 forward from the tail (second recording position; tail) to the head (first recording position), and is stored in the storage area 61.
  • the oldest record that can be read is specified.
  • the oldest record specifying unit 11 reads the forward data length 103 based on the backward data length 113, and the boundary between the latest record and the oldest record (hereinafter referred to as the oldest record) from the mismatch of the forward data length 103 and the backward data length 113.
  • the boundary is also referred to as a first recording area, data boundary position, or overwrite position).
  • the oldest record specifying unit 11 includes a record scanning unit 21, a data length acquisition unit 23, a data length comparison unit 25, a rotation flag comparison unit 27, and a head / tail flag determination unit 29.
  • the record scanning unit 21 sequentially reads records one by one from the end of the storage area 61 of the nonvolatile memory 9 toward the front, and reads the rear data length 113. For example, when the record scanning unit 21 moves to the next (one older) record, the record data in the storage area 61 (the value of the read back data length 113 +3) bytes ahead is used as the back data length of the next record. Read as the value of 113.
  • the data length acquisition unit 23 reads the front data length 103 based on the rear data length 113 read by the record scanning unit 21. For example, the data length acquisition unit 23 reads, as the front data length 103, an area ahead of the storage area 61 (the value of the rear data length 113 read by the record scanning unit 21 + 1) bytes.
  • the data length comparison unit 25 compares the forward data length 103 read by the record scanning unit 21 with the backward data length 113 to determine whether they match, and the forward data length 103 and backward data length 113 are compared. If they do not match, the record position is stored in the overwrite position storage unit 51 of the RAM 7.
  • the rotation flag comparison unit 27 compares the rotation flag 107 of the record read by the record scanning unit 21 with the rotation flag 107 of the previous (one new) record. Details of this processing will be described later using an example (3) in FIG.
  • the head / tail flag determination unit 29 determines whether the value of the head flag 101 before the forward data length 103 and the value of the tail flag 111 before the rear data length 113 are “0” or “1”.
  • the latest record specifying unit 13 traces the storage area 61 of the nonvolatile memory 9 from the top and specifies the position of the newest latest record among the records stored in the storage area 61. Based on the forward data length 103, the latest record specifying unit 13 follows from the front of the storage area 61 to the data boundary position (overwrite position) specified by the oldest record specifying unit 11, and then writes data. The position (recording start position of the next data set; second recording area) is specified.
  • the latest record specifying unit 13 includes a record scanning unit 31, a data length acquisition unit 33, and a latest record position specifying unit 35.
  • the record scanning unit 31 traces records one by one in order from the top to the back of the storage area 61 of the nonvolatile memory 9, and reads the forward data length 103. For example, when the record scanning unit 31 moves to the next (one new) record, the record scanning unit 31 sets the area behind (the value of the read forward data length 103 +3) bytes in the forward data length of the next record. Read as a value of 103.
  • the data length acquisition unit 33 reads the rear data length 113 based on the front data length 103 read by the record scanning unit 31. For example, the data length acquisition unit 33 reads a region behind the storage region 61 (the value of the forward data length 103 read by the record scanning unit 31 + 1) bytes as the backward data length 113.
  • the latest record position specifying unit 35 compares the forward data length 103 read by the record scanning unit 31, the backward data length 113 read by the data length acquisition unit 33, and the value stored in the overwrite position storage unit 51 of the RAM 7. Thus, it is determined whether or not the overwrite position stored in the overwrite position storage unit 51 of the RAM 7 is between the forward data length 103 and the backward data length 113.
  • the writing unit 15 writes a record to the storage area 61 of the nonvolatile memory 9. Specifically, the writing unit 15 generates a temporary record in the temporary record storage unit 53 of the RAM 7 and transfers data from the temporary record storage unit 53 to the storage area 61 when the generation of the record is completed.
  • the writing unit 15 includes a data combination flag setting unit 41, an overlapping position information generation unit 43, a rotation flag setting unit 45, and a record transfer unit 47.
  • the data combination flag setting unit 41 divides the data into two when the data does not fit at the end of the storage area 61 and sets the value “1” in the data combination flag 115 (see FIG. 3).
  • the duplicate position information generation unit 43 matches the position of 1 byte in the new data part 109 to be written with the position of the forward data length 103 of the old record (overlap), and the new data and the old record.
  • the forward data length 103 is the same value
  • the duplicate byte is bit-inverted.
  • the overlapping position information generation unit 43 records the position of the bit-inverted byte in the data portion 109 with reference to the head of the data portion 109 in the overlapping position information 107.
  • the value of the first header byte 123 is “0x04” because the top flag 101 of the old record is “0” and the forward data length 103 is “4”.
  • the second byte of the data portion 109 of the data to be written is also “0x04”.
  • the duplication position information generation unit 43 described later inverts the bit “0x04” of the second byte of the data unit 109 to “0xFB”. Further, the duplication position information generation unit 43 sets a value “2” that is the bit position (second byte in this example) of the data portion 109 with the bit inverted in the duplication position information 107.
  • the rotation flag setting unit 45 sets the rotation flag value stored in the rotation flag storage unit 55 of the RAM 7 to the rotation flag 107 of the data to be written. Also, the rotation flag setting unit 45 inverts the value of the rotation flag storage unit 55 of the RAM 7 when the write position returns to the top of the storage area 61, for example.
  • the record transfer unit 47 receives data to be written from the control program 93 or an OS (not shown), generates a record structure 100 based on this data, and stores it in the temporary record storage unit 53. Further, the record transfer unit 47 completes the processing of the data combination flag setting unit 41, the overlapping position information generation unit 43, and the rotation flag setting unit 45, and when the temporary record in the temporary record storage unit 53 is completed, Forward to 61.
  • the reading unit 17 reads the records written in the storage area 61 from the oldest order. Next, processing at the time of data writing in the variable-length record recording unit 3 as an example of the first embodiment will be described.
  • FIG. 5 is a flowchart showing processing at the time of data writing in the variable-length record recording unit 3 as an example of the first embodiment.
  • step S1 the process moves to the last record in the storage area 61 of the nonvolatile memory 9.
  • step S3 the data length acquisition unit 23 reads the rear data length 113 of the current record from the record scanning unit 21.
  • step S5 the data length acquisition unit 23 reads the forward data length 103 of the record based on the backward data length 113 read in step S3.
  • step S9 the data length comparison unit 25 determines whether the backward data length 113 read in step S3 is equal to the forward data length 103 read in step S5.
  • step S11 the rotation flag comparison unit 27 reads the current record read by the record scanning unit 21 and the preceding record. It is determined whether the rotation flags 107 of the (one new) records match. If the rotation flag 107 does not match in step S11 (see the NO route in step S11), in step S13, the head / tail flag determination unit 29 sets the value of the head bit 101 before the forward data length 103 to “0”. Determine whether it is set.
  • step S15 the data length comparison unit 25 determines the backward data length 113 and the forward data length 103.
  • the record that does not match is determined as the position where the latest record exists. That is, when the latest record is written at this position, the forward data length 103 of the old record is overwritten, and the values of the forward data length 103 and the backward data length 113 do not match. For this reason, the data length comparison unit 25 determines that the record in which the front data length 103 and the rear data length 113 coincide immediately before is the oldest record.
  • the data length comparison unit 25 stores the position of the latest record (hereinafter also referred to as an overwrite position) in which the values of the forward data length 103 and the backward data length 113 do not match in the overwrite position storage unit 51 of the RAM 7. .
  • This position is used in the search from the front by the latest record specifying unit 13.
  • the process proceeds to step S15.
  • step S11 If the rotation flag 107 matches in step S11 (see YES route in step S11), the process proceeds to step S7.
  • the record scanning unit 21 sets 1 in the storage area 61 of the nonvolatile memory 9 in step S7. Moves to the previous record (next oldest) record, and the backward data length 113 is read.
  • step S ⁇ b> 17 the record scanning unit 31 moves to the first record in the storage area 61 of the nonvolatile memory 9 and reads the forward data length 103.
  • step S19 the data length acquisition unit 33 reads the rear data length 113 of the record based on the front data length 103 read in step S17.
  • step S21 the latest record position specifying unit 35 stores the position stored in the overwrite position storage unit 51 between the forward data length 103 read in step S17 and the backward data length 113 read in step 8. It is determined whether (overwrite position) is included. When the overwrite position is not included between the forward data length 103 and the backward data length 113 (see NO route in step S21), the overwrite position has not yet been passed in the forward reading of the storage area 61. For this reason, in step S23, the record scanning unit 31 moves to the next record (new record) and reads the forward data length 103 of the record.
  • step S21 the processes in steps S19 to S23 are repeated until an overwrite position is included between the forward data length 103 and the backward data length 113. If the overwriting position is included between the front data length 103 and the rear data length 113 in the determination in step S21 (see YES route in step S21), the processing shifts to writing processing. The current record becomes the latest record, and the next write position is the position next to the latest record.
  • step S25 it is determined whether the position of the 1-byte byte in the data section 109 to be written next matches the position of the forward data length 103 of the oldest record, and whether both values match. For example, in the example of FIG. 3, the position of the second byte (value “0x04”) of the data to be written (data portion 109) and the position of the forward data length 103 (value “4”) of the old data are one. And both are the same value.
  • step S27 The overlap position information generation unit 43 bit-inverts the overlap position data. Further, the duplication position information generation unit 43 sets the bit-inverted position (relative position where the first byte of the data part in the record is 1) in the duplication position information 107 of the temporary record storage unit 53 of the RAM 7.
  • the overlapping position information generation unit 43 sets “0xFB” obtained by bit-inverting “0x04” of the second byte of the data to be written to the data portion of the temporary record storage unit 53 of the RAM 7. Write to the second byte of 109. Further, the duplication position information generation unit 43 writes “2” of the byte position with the bit inverted in the duplication position information 107 of the temporary record storage unit 53.
  • step S29 the record transfer unit 47 writes the forward data length 103, the backward data length 113, and the rotation flag 105 in the temporary record storage unit 53 of the RAM 7. Then, the record is transferred to the write position in the storage area 61 of the nonvolatile memory 9 and the record is written to the nonvolatile memory 9.
  • FIG. 6 is a diagram illustrating various data writing examples in the variable-length record recording unit 3 as an example of the first embodiment.
  • the dashed arrow indicates the first round of writing to the storage area 61 of the nonvolatile memory 9
  • the solid line arrow indicates the second round of writing.
  • the diagonally downward slanting portion on the left indicates the first header byte 123.
  • the horizontal line portion indicates the second header byte 125.
  • the diagonally downward hatched portion on the right indicates a footer portion 127.
  • data bytes are expressed in hexadecimal.
  • the example (1) in FIG. 6 shows processing when data is recorded for the first time (first round) in the storage area 61.
  • the rotation flag setting unit 45 sets a value “0” in the rotation flag storage unit 55 of the RAM 7.
  • the data combination flag 115, the record a, the record b, the record c, and the record d are sequentially written in the storage area 61.
  • the length of the data portion 109 is 3 bytes for record a, 4 bytes for record b, 2 bytes for record c, and 1 byte for record d.
  • the value “0” stored in the rotation flag storage unit 55 of the RAM 7 is written to the rotation flag 105 of the records a to d, and the overlap position information 107 has the value “0” because there is no overlap position. Is written. Therefore, the value of the second header byte 125 is “0x00”. Further, “0x83”, “0x84”, “0x82”, and “0x82” are respectively written in the footer portion 127 of the record.
  • the rotation flag storage unit 55 Inverts the value “0” stored in the rotation flag storage unit 55 of the RAM 7 in order to indicate the rotation change. Set. Then, as shown in Example (2), immediately after the data combination flag 115 in the storage area 61, a new record e having a length of 1 in the data portion 109 is written.
  • the value “1” stored in the rotation flag storage unit 55 is written to the rotation flag 105 of the record e, and the value “0” is written to the overlap position information 107 because there is no overlap position. . Therefore, the value of the second header byte 125 is “0x80”. Thereafter, the oldest record specifying unit 11 traces the record forward from the end of the storage area 61 as indicated by a left-pointing arrow. Since the value “3” of the backward data length 113 of the overwritten record “a” and the value “1” of the forward data length 103 of the record “e” do not match, the data length comparison unit 25 defines the boundary between the old and new data. It is determined that it exists in the vicinity.
  • the oldest record specifying unit 11 traces the record forward from the end of the storage area 61 as indicated by a left-pointing arrow. Since the value “3” of the backward data length 113 of the overwritten record “a” does not match the value “2” of the backward data length 113 of the record “e”, the data length comparison unit 25 defines the boundary between the old and new data. It is determined that it exists in the vicinity.
  • the next example (4) is another case where the position of the forward data length 103 of the old record and the forward data length 103 of the new record overlap. As shown in the example (4), immediately after the data combination flag 115 in the storage area 61, a new record e having a length of 3 in the data portion 109 is written.
  • the value “1” stored in the rotation flag storage unit 55 is written to the rotation flag 105 of the record e, and the value “0” is written to the overlap position information 107 because there is no overlap position. . Therefore, the value of the second header byte 125 is “0x80”. Thereafter, the oldest record specifying unit 11 traces the record forward from the end of the storage area 61 as indicated by a left-pointing arrow.
  • the data length comparison unit 25 determines that the value “3” of the backward data length 113 of the overwritten record a matches the value “3” of the backward data length 113 of the record e.
  • the rotation flag comparison unit 27 compares the rotation flags, so that the record b is the older data. Can be determined.
  • the next example (5) is a case where the positions of the forward data length 103 of the old record and the backward data length 113 of the new record overlap.
  • a new record e having a length of 4 in the data portion 109 is written.
  • the value “1” stored in the rotation flag storage unit 55 is written to the rotation flag 105 of the record e, and the value “0” is written to the overlap position information 107 because there is no overlap position. . Therefore, the value of the second header byte 125 is “0x80”.
  • the oldest record specifying unit 11 traces the record forward from the end of the storage area 61 as indicated by the left-pointing arrow.
  • the data length comparison unit 25 erroneously recognizes the value of the backward data length 113 of the record e as the forward data length 103, and the backward data length 113 of the record b in which the value “4” of the backward data length 113 is overwritten. It is determined that the value matches the value “4”.
  • the head / tail flag determination unit 29 has the value of the flag immediately before the value “4” of the backward data length 113 of the overwritten record b as “1”, and the comparison is made with the forward data length 103. However, since it is determined that the data length is the backward data length 113, it is determined that the boundary between the old and new data exists in this vicinity. In the next example (6), the position of the 1st byte (5th byte) in the data portion 109 of the new record matches the position of the forward data length 103 of the old record. In this case, the data length 103 does not match the value. As shown in the example (6), immediately after the data combination flag 115 in the storage area 61, a new record e having a length of 2 in the data portion 109 is written.
  • the value “1” stored in the rotation flag storage unit 55 is written to the rotation flag 105 of the record e, and the value “0” is written to the overlap position information 107 because there is no overlap position. . Therefore, the value of the second header byte 125 is “0x80”. Thereafter, the oldest record specifying unit 11 traces the record forward from the end of the storage area 61 as indicated by a left-pointing arrow. When the data length comparison unit 25 does not match the value of the backward data length 113 of the overwritten record b with the data of the data portion of the record e, the record b is invalid, and there is a boundary between the old and new data here. I can judge.
  • the position of the 1st byte (5th byte) in the data portion 109 of the new record matches the position of the forward data length 103 of the old record, and the byte to be written and the forward data of the old record This is a case where the value of the length 103 matches.
  • a new record e having a length of 2 in the data portion 109 is written.
  • the value “1” stored in the rotation flag storage unit 55 is written in the rotation flag 105 of the record e.
  • the byte is inverted.
  • the inverted byte position “5” is written in the overlap position information 107. Therefore, the value of the second header byte 125 is “0x85”.
  • the data length comparison unit 25 matches the value of the backward data length 113 of the overwritten record b with the data of the data portion of the record e.
  • this value is the same value as the forward data length 103 at the time of previous writing, and the corresponding portion is the data byte or the forward data length 103. Cannot be determined.
  • the data of the corresponding part is bit-inverted to “0xFB”, and the inverted byte position is recorded in the overlapping position information 107.
  • the next example (8) is a case where the position of the forward data length 103 of the old record and the position of the duplicate position information 107 of the new record overlap.
  • a new record e having a backward data length 113 is written immediately after the data combination flag 115 in the storage area 61, and subsequently a new record f having a length of 3 in the data portion 109 is written.
  • the data length of the old data is overwritten with the duplication position information 107 of the record f. Since the overlapping position information 107 is “0”, does not match the backward data length 113, and the value “0” is an invalid value for the data length, it can be determined that the boundary between the old and new data exists in this vicinity.
  • the broken-line arrows indicate the first round of writing to the storage area 61 of the nonvolatile memory 9
  • the solid-line arrows indicate the second round of writing.
  • the diagonally downward slanting portion on the left indicates the first header byte 123.
  • the horizontal line portion indicates the second header byte 125.
  • the diagonally downward hatched portion on the right indicates a footer portion 127.
  • data bytes are expressed in hexadecimal.
  • the variable length record recording unit 3 writes the data uniformly and evenly in the storage area 61.
  • the data is divided and recorded. Specifically, when the size of the data to be written and the total size of the header part 121 and the footer part 127 exceed the remaining capacity of the storage area 61, the data combination flag setting unit 41 divides the data to be written. At that time, the size of the data part 109 to be recorded at the end of the storage area 61 is expressed by the following formula (remaining capacity of the storage area 61) ⁇ (size of the header part 121 + size of the footer part 127). Is required. Data is divided by this size to form a data part 109, and a header part 121 and a footer part 127 are added to write a record.
  • the remaining data is similarly recorded from the top of the storage area 61 with the header part 121 and the footer part 127 added thereto.
  • the value “1” is set in the head data combination flag 115 of the storage area 61 in order to indicate that the tail record and the head record are originally one data.
  • the data combination flag setting unit 41 pads the remaining 7 bits of the first byte of the storage area 61 with, for example, “0” in order to match the byte boundary. .
  • the minimum record size is a total size of the header part 121, the data part 109, and the footer part 127 (for example, 4 bytes in the example of FIG. 2). Therefore, when the remaining area of the storage area 61 is smaller than this size, the remaining area is filled with “0”.
  • steps S1 to S23 in the flowchart of FIG. 8 are executed to specify the position of the oldest record and the position of the latest record. Since these processes are the same as steps S1 to S23 in the flowchart of FIG. 5, description thereof is omitted.
  • the reading unit 17 reads records in order from the oldest record.
  • step S ⁇ b> 33 the reading unit 17 determines whether the end of the storage area 61 has been reached. When the end of the storage area 61 has not been reached (refer to the NO route in step S33), in step S35, the reading unit 17 reads the previous (next oldest) record. The processes in steps S33 and S35 are repeated until the end of the storage area 61 is reached.
  • the reading unit 17 When the end of the storage area 61 is reached (see YES route in step S33), the reading unit 17 reads the top record in the storage area 61 in step S37. In step S39, the reading unit 17 determines whether or not the latest record has been reached. If the latest record has not been reached (see NO route in step S39), in step S41, the reading unit 17 reads the previous (next oldest) record.
  • the reading process is terminated.
  • the reading unit 17 reads data forward from the last record in the storage area 61, then moves to the top of the storage area 61, and reads records backward from the top record in the order of the latest record.
  • the data can be read in the order in which the data is written.
  • FIG. 9 is a schematic diagram illustrating a hardware configuration of the device 1 including the system control unit 1 as an example of the first embodiment.
  • the system control unit 1 performs some control on the control target 97.
  • the control target 97 is a server body.
  • the system control unit 1 includes a variable length record recording unit 3 and a control program 93 for actually controlling the control target 97.
  • the variable length record recording unit 3 of the system control unit 1 stores an operation log related to control and an abnormality log of the control target 97 in the storage area 61 of the nonvolatile memory 9.
  • the variable-length record recording unit 3 writes log data using the record structure 100 shown in FIG.
  • FIG. 12 For comparison with the present embodiment, an example of a technique for repeatedly recording a variable-length record having only forward data length information sequentially in a storage area is shown in FIG.
  • the data write start position (hereinafter also referred to as overwrite position) to the storage area and the storage area are already written.
  • the data read start position is managed.
  • (1) of FIG. 12 data is written from the beginning to the end of the storage area in the order of data A, data B, data C, and data D. Further, header information indicating the length of the data portion is added in front of these variable length data A to D, respectively.
  • data E is written after data D. After a part of the data E is written to the end of the storage area, it returns to the top of the storage area and the rest of the data E is written. In this case, since the data A recorded at the head of the storage area is overwritten by the data E, the oldest readable data becomes the data B. For this reason, the data read start position must be recognized as the head of data B (that is, header information of data B). Thereafter, data F is written after data E as shown in FIG.
  • this method has header information only at the beginning of the data. For this reason, as shown in (2) and (3) of FIG. 12, if the header portion of the data A is overwritten by returning to the beginning of the storage area, the position of the oldest record that can be read is unknown. End up. In order to avoid such a situation, it is conceivable to provide a data write start position and a read start position in the nonvolatile storage area. However, if a data write start position and a read start position are provided in the nonvolatile storage area, the frequency of writing at the position where these data are stored increases, and the element life of the nonvolatile storage area decreases.
  • the new data write start position and the storage area are written from the nonvolatile memory 9 itself. It is possible to specify the read start position of the read data. There is no need to store the data write start position and the read start position in the nonvolatile memory 9, and the variable length records 100 are evenly distributed over the entire area of the nonvolatile memory 9 without the writing frequency of the nonvolatile memory 9 being biased to a specific area. It can be recorded.
  • the duplicate byte is bit-inverted, and the bit-inverted position is the duplicate position information 107.
  • the head flag 101, the rotation flag 105, and the tail flag 111 are provided, it is possible to prevent the forward data length 103 and the backward data length 113 from being confused with other information. Also, by dividing the data using the data combination flag 115, the data can be packed to the end of the storage area 61, so that the data can be stored evenly.
  • FIG. 10 is a schematic diagram illustrating a configuration of a system control unit 1 ′ as an example of the present embodiment.
  • the system control unit 1 ′ of the present embodiment stores the next record write position 71, the previous data length arrangement information 73 for the previous rotation, and the current rotation information in the RAM 7. Forward data length arrangement information 75. Since the other configuration of the system control unit 1 ′ of the present embodiment is the same as that of the system control unit 1 of the first embodiment illustrated in FIGS. 1 and 4, the description and illustration thereof are omitted.
  • the next record writing position 71 is an address at which data writing to the storage area 61 is started.
  • the forward data length arrangement information 73 for the previous rotation is an area for storing the address (offset position) and the value of each forward data length 103 of all records written in the storage area 61 in the previous rotation.
  • the forward data length arrangement information 75 for the current rotation is an area for storing the address (offset position) and the value of each forward data length 103 of all records written in the storage area 61 in the current rotation.
  • the forward data length arrangement information 75 is created when the variable length record recording unit 3 writes data to the storage area 61.
  • the forward data length arrangement information 75 for the current rotation is collectively transferred to the forward data length arrangement information 73 for the previous rotation, and the current data for the current rotation is rotated.
  • the front data length arrangement information 75 is cleared.
  • FIG. 11 is a flowchart illustrating processing at the time of data writing in the variable-length record recording unit as an example of the second embodiment. Since the next record writing position 71, the forward data length arrangement information 73 for the previous rotation, and the forward data length arrangement information 75 for the current rotation are stored in the RAM 7, they are erased when the system controller 1 'is powered off. . For this reason, initialization of step S51 is performed after the system controller 1 'is powered on. In this initialization, the processing of steps S1 to S23 in FIG. 8 is executed to read data from the storage area 61 of the nonvolatile memory 9. Further, the next record position of the record determined in step S 21 in FIG. 8 is stored in the next record write position 71 of the RAM 7. Further, the forward data length 103 of all records stored in the storage area 61 is sequentially stored in the forward data length arrangement information 75 for the current rotation.
  • the writing unit 15 reads the writing position from the next record writing position 71 of the RAM 7 in step S53.
  • step S55 the writing unit 15 determines whether there is an overlap in the forward data length 103 of the current rotation forward data length arrangement information 75 in the RAM 7 that overlaps the range in which the latest record is written and the data matches. Whether or not is determined based on the address (offset).
  • step S57 The overlapping position information generation unit 43 bit-inverts the byte at the overlapping position. Further, the overlapping position information generating unit 43 sets the position of the byte with the bit inverted in the overlapping position information 107.
  • step S59 a record is written.
  • the forward data length 103 of the written record is stored at the end of the forward data length arrangement information 75 for the current rotation.
  • step S ⁇ b> 61 the writing unit 15 determines whether rotation has been performed, that is, whether writing has been performed to the end of the storage area 61.
  • step S63 the writing unit 15 transfers the forward data length arrangement information 75 for current rotation to the forward data length arrangement information 73 for previous rotation in a batch. Thereafter, the forward data length arrangement information 75 for rotation this time is cleared.
  • step S65 the writing unit 15 adds the address (offset position) and the value of the forward data length 103 of the written record to the end of the forward data length arrangement information 75 for current rotation.
  • step S67 the writing unit 15 updates the next record writing position 71.
  • the present invention is not limited to the configurations described in the above-described embodiments and modifications, and various modifications can be made without departing from the spirit of the present invention.
  • the data length shown in FIG. 2 is merely an example, and the data length can be appropriately changed according to the object controlled by the system control unit 1, the control program 93, and the OS log format (not shown).
  • the function and structure in each functional block shown in FIG. 4 are only examples, and the combination of the functions of each block may be changed as appropriate.
  • the execution order of the steps of the processing flow may be changed. Furthermore, although the duplication of the position between the forward data length 103 of the old data and the data to be written is determined in units of 1 byte, the duplication may be determined in units of multiple bytes.
  • the CPU 5 of the system control unit 1 or 1 ′ executes the variable-length record recording program, so that the variable-length record recording unit 3, the oldest record specifying unit 11, and the latest record shown in FIG.
  • Record identification unit 13 writing unit 15, reading unit 17, record scanning unit 21, data length acquisition unit 23, data length comparison unit 25, rotation flag comparison unit 27, head / tail flag determination unit 29, record scanning unit 31, It functions as the data length acquisition unit 33, the latest record position specifying unit 35, the data combination flag setting unit 41, the overlapping position information generation unit 43, the rotation flag setting unit 45, and the record transfer unit 47.
  • the RAM 7 of the system control unit 1 or 1 ′ includes the overwrite position storage unit 51, the temporary record storage unit 53, the rotation flag storage unit 55, the next record writing position 71, the previous data length arrangement information 73 for the previous rotation, and the current time It functions as forward data length arrangement information 7 for rotation.
  • variable-length record recording unit 3 oldest record specifying unit 11, latest record specifying unit 13, writing unit 15, reading unit 17, record scanning unit 21, data length obtaining unit 23, data length comparing unit 25, rotation Flag comparison unit 27, head / tail flag determination unit 29, record scanning unit 31, data length acquisition unit 33, latest record position specifying unit 35, data combination flag setting unit 41, duplicate position information generation unit 43, rotation flag setting unit 45 and a variable-length record recording program (variable-length record recording program) for realizing the function as the record transfer unit 47 are, for example, a flexible disk, CD (CD-ROM, CD-R, CD-RW, etc.), DVD (DVD-ROM, DVD-RAM, DVD-R, DVD + R, DVD-RW, DVD + W, HD DVD, etc.), a Blu-ray disc, a magnetic disk, an optical disk, such as a magneto-optical disk, is provided in a format recorded on a computer-readable recording medium.
  • a flexible disk CD (CD-ROM, CD-R, CD-RW, etc.)
  • DVD DVD-
  • the computer reads the program from the recording medium, transfers it to the internal storage device or the external storage device, stores it, and uses it.
  • the program may be recorded in a storage device (recording medium) such as a magnetic disk, an optical disk, or a magneto-optical disk, and provided from the storage device to the computer via a communication path.
  • Variable length record recording unit 3 oldest record specifying unit 11, latest record specifying unit 13, writing unit 15, reading unit 17, record scanning unit 21, data length acquiring unit 23, data length comparing unit 25, rotation flag comparing unit 27 , Head / tail flag determination unit 29, record scanning unit 31, data length acquisition unit 33, latest record position specifying unit 35, data combination flag setting unit 41, overlapping position information generation unit 43, rotation flag setting unit 45, and record
  • the program stored in the internal storage device in the present embodiment, the system control unit 1 or the RAM 7 of 1 '
  • the system control unit 1 the RAM 7 of 1 '
  • the computer may read and execute the program recorded on the recording medium.
  • the computer is a concept including hardware and an operating system, and means hardware that operates under the control of the operating system. Further, when an operating system is unnecessary and hardware is operated by an application program alone, the hardware itself corresponds to a computer.
  • the hardware includes at least a microprocessor such as a CPU and means for reading a computer program recorded on a recording medium.
  • the system control unit 1 or 1 'functions as a computer. have.
  • This technology can be used to record variable length records such as variable length log recording and data backup.
  • 1,1 'system controller (recording device) 100 record structure (data set, data) 101 head flag (information indicating the head of the data set) 103 Forward data length (forward data length information) 105 rotation flag (information indicating write rotation) 107 Duplicate position information (information of bit-inverted position) 109 Data part 11 Oldest record specifying part 13 Latest record specifying part 15 Writing part 111 End flag (information indicating the end of the data set) 113 Back data length (back data length information) 115 Data Combined Flag 123 First Header Byte 125 Second Header Byte 127 Footer 3 Variable Length Record Recording 5 CPU (Processor) 7 RAM (another storage device) 71 Position for writing next record 75 Data length arrangement information 9 Non-volatile memory (storage device) 97 Control target

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

This invention comprises: sequentially recording, in the direction from the first recording location toward the second recording location of a storage area (9) in a recording device (1), a dataset including variable-length data and anterior and posterior-data length information (103, 113), the information indicating the length of the same data and being recorded in front of and behind the same data; returning the process to the first recording location and overwriting the recorded data with a new dataset in the direction from the first recording location toward the second recording location, in which state a first recording area is identified in which there is continuously discovered a dataset containing posterior-data length information corresponding to the recording location of posterior-data length information determined from the posterior-data length information in the direction from the second recording location toward the first recording location; and setting the recording location to the recording start location of the next dataset subsequent to the dataset that contains posterior-data length information corresponding to the recording location of posterior-data length information determined from the posterior-data length information in the direction from the first recording location toward the second recording location, and that is recorded in the nearest location to the first recording area without approaching the first recording area.

Description

記録方法、記録装置及び記録プログラムRecording method, recording apparatus, and recording program
 本件は、記録方法、記録装置及び記録プログラムに関する。 This case relates to a recording method, a recording apparatus, and a recording program.
 可変長データを記憶装置にシーケンシャルに記録する処理は、各種用途において広く行なわれている。
 例えば、プログラムを実行したり装置を動作させる際に、当該プログラムや装置のログ情報が記憶装置に記録される。このようなプログラムや装置の動作ログ情報は、障害発生時の解析を行なう場合などに必須である。
The process of sequentially recording variable length data in a storage device is widely performed in various applications.
For example, when executing a program or operating a device, log information of the program or device is recorded in a storage device. Such operation log information of the program and apparatus is indispensable when performing analysis when a failure occurs.
 このような動作ログのデータは、可変長データ(以下、可変長データを「可変長レコード」と呼ぶこともある)であることが多い。
 また、装置のサイズが制限される組み込み機器などでは、動作ログが不揮発メモリに記録される。
Such operation log data is often variable-length data (hereinafter, variable-length data may be referred to as “variable-length record”).
In addition, in an embedded device in which the size of the device is limited, an operation log is recorded in a nonvolatile memory.
特開2007-129319号公報JP 2007-129319 A 特開2004-118407号公報JP 2004-118407 A
 このため、素子寿命の観点から、書き込み頻度が不揮発メモリの特定の領域に偏よることなく、不揮発メモリの記憶領域に可変長データをシーケンシャルに記録することが望ましい。
 1つの側面では、本発明は、不揮発記憶装置の記憶領域に可変長データをシーケンシャルに記録させるための技術を提供することを目的とする。
For this reason, from the viewpoint of device lifetime, it is desirable to record variable length data sequentially in the storage area of the nonvolatile memory without the writing frequency being biased to a specific area of the nonvolatile memory.
In one aspect, an object of the present invention is to provide a technique for sequentially recording variable length data in a storage area of a nonvolatile storage device.
 このため、記録装置にデータを記録する記録方法において、処理装置は、前記記録装置の記憶領域のうちの第1の記録位置から第2の記録位置に向けて、可変長データと、それぞれ該可変長データのデータ長を示し、該可変長データの前方及び後方に記録される前方及び後方データ長情報を含むデータセットを順次記録し、残り記録領域の不足発生に応じて前記第1の記録位置に戻って、前記第1の記録位置から前記第2の記録位置に向けて、記録済のデータを新たなデータセットで上書きした状態において、前記第2の記録位置から前記第1の記録位置に向けて後方データ長情報から求まる前方データ長情報の記録位置に対応する前方データ長情報が存在するデータセットが連続的に発見される第1の記録領域を特定し、前記第1の記録位置から前記第2の記録位置に向けて、前方データ長情報から求まる後方データ長情報の記録位置に対応する後方データ長情報が存在するデータセットであって、前記第1の記録領域に差し掛からず、前記第1の記録領域に最も近い位置に記録されたデータセットに後続させて、次のデータセットの記録開始位置として利用する、処理を実行する。 For this reason, in the recording method for recording data in the recording device, the processing device has the variable length data and the variable data respectively from the first recording position to the second recording position in the storage area of the recording device. The first recording position indicates the data length of the long data, sequentially records a data set including front and rear data length information recorded in front and rear of the variable length data, and the remaining recording area is insufficient. Returning to FIG. 2, in a state where the recorded data is overwritten with a new data set from the first recording position toward the second recording position, the second recording position is changed to the first recording position. A first recording area in which a data set having forward data length information corresponding to a recording position of forward data length information obtained from backward data length information is continuously found, and the first recording A data set in which backward data length information corresponding to a recording position of backward data length information obtained from forward data length information exists from a position toward the second recording position, First, a process is performed in which the data set recorded at the position closest to the first recording area is used as a recording start position of the next data set.
 また、この記録装置は、記憶領域を有する記録装置であって、前記記録装置の記憶領域のうちの第1の記録位置から第2の記録位置に向けて、可変長データと、それぞれ該可変長データのデータ長を示し、該可変長データの前方及び後方に記録される前方及び後方データ長情報を含むデータセットを順次記録し、残り記録領域の不足発生に応じて前記第1の記録位置に戻って、前記第1の記録位置から前記第2の記録位置に向けて、記録済のデータを新たなデータセットで上書きした状態において、前記第2の記録位置から前記第1の記録位置に向けて後方データ長情報から求まる前方データ長情報の記録位置に対応する前方データ長情報が存在するデータセットが連続的に発見される第1の記録領域を特定し、前記第1の記録位置から前記第2の記録位置に向けて、前方データ長情報から求まる後方データ長情報の記録位置に対応する後方データ長情報が存在するデータセットであって、前記第1の記録領域に差し掛からず、前記第1の記録領域に最も近い位置に記録されたデータセットに後続させて、次のデータセットの記録開始位置として利用する。 In addition, this recording apparatus is a recording apparatus having a storage area, and variable length data and each variable length from the first recording position to the second recording position in the storage area of the recording apparatus. A data set that indicates the data length of the data, and sequentially records a data set including forward and backward data length information recorded in front and rear of the variable-length data, and is recorded at the first recording position according to the occurrence of a shortage of the remaining recording area. Returning from the first recording position to the second recording position, the recorded data is overwritten with a new data set, and then the second recording position is directed to the first recording position. A first recording area in which a data set having forward data length information corresponding to the recording position of the forward data length information obtained from the backward data length information is continuously found, and A data set in which backward data length information corresponding to a recording position of backward data length information obtained from forward data length information is present toward the second recording position, and does not reach the first recording area, Following the data set recorded at the position closest to the first recording area, it is used as the recording start position of the next data set.
 また、この記録プログラムは、コンピュータに、記録装置にデータを記録させる記録プログラムであって、前記コンピュータに、前記記録装置の記憶領域のうちの第1の記録位置から第2の記録位置に向けて、可変長データと、それぞれ該可変長データのデータ長を示し、該可変長データの前方及び後方に記録される前方及び後方データ長情報を含むデータセットを順次記録し、残り記録領域の不足発生に応じて前記第1の記録位置に戻って、前記第1の記録位置から前記第2の記録位置に向けて、記録済のデータを新たなデータセットで上書きした状態において、前記第2の記録位置から前記第1の記録位置に向けて後方データ長情報から求まる前方データ長情報の記録位置に対応する前方データ長情報が存在するデータセットが連続的に発見される第1の記録領域を特定し、前記第1の記録位置から前記第2の記録位置に向けて、前方データ長情報から求まる後方データ長情報の記録位置に対応する後方データ長情報が存在するデータセットであって、前記第1の記録領域に差し掛からず、前記第1の記録領域に最も近い位置に記録されたデータセットに後続させて、次のデータセットの記録開始位置として利用する、処理を実行させる。 Further, the recording program is a recording program for causing a computer to record data on the recording device. The recording program causes the computer to move from a first recording position to a second recording position in a storage area of the recording device. The variable length data and the data length of the variable length data are respectively indicated, the data set including the front and rear data length information recorded in front and rear of the variable length data is sequentially recorded, and the remaining recording area is insufficient. Accordingly, the second recording position is returned to the first recording position and the recorded data is overwritten with a new data set from the first recording position to the second recording position. A data set in which forward data length information corresponding to the recording position of the forward data length information obtained from backward data length information from the position to the first recording position exists is continuous. The first recording area to be found is specified, and the backward data length information corresponding to the recording position of the backward data length information obtained from the forward data length information from the first recording position toward the second recording position is An existing data set that does not reach the first recording area but is used as the recording start position of the next data set following the data set recorded at the position closest to the first recording area To execute the process.
 上記可変長レコードの記録方法、不揮発記憶装置及び可変長レコード記録プログラムによれば、不揮発記憶装置自体から、新しいデータの書き込み開始位置と、不揮発記憶装置に書き込まれているデータの読み出し開始位置とを特定することができる。このため、不揮発記憶装置の記憶領域に可変長レコードをシーケンシャルに記録させることが可能となる。 According to the above-mentioned variable length record recording method, nonvolatile storage device, and variable length record recording program, the new data write start position and the read start position of data written in the nonvolatile storage device are determined from the nonvolatile storage device itself. Can be identified. For this reason, it is possible to sequentially record variable-length records in the storage area of the nonvolatile storage device.
第1実施形態の一例としてのシステム制御部のハードウェア構成を示す模式図である。It is a schematic diagram which shows the hardware constitutions of the system control part as an example of 1st Embodiment. 第1実施形態の一例としてのシステム制御部において使用されるレコード構造を示す図である。It is a figure which shows the record structure used in the system control part as an example of 1st Embodiment. 第1実施形態の一例における重複位置情報の使用法を示す図である。It is a figure which shows the usage method of the duplication position information in an example of 1st Embodiment. 第1実施形態の一例としてのシステム制御部の機能構成を示す模式図である。It is a schematic diagram which shows the function structure of the system control part as an example of 1st Embodiment. 第1実施形態の一例としての可変長レコード記録部におけるデータの書き込み時の処理を示すフローチャートである。It is a flowchart which shows the process at the time of the data writing in the variable length record recording part as an example of 1st Embodiment. 第1実施形態の一例としての可変長レコード記録部におけるさまざまなデータの書き込み例を示す図である。It is a figure which shows the example of writing various data in the variable-length record recording part as an example of 1st Embodiment. 第1実施形態の一例としての可変長レコード記録部における記憶領域の末尾と先頭をまたいだデータの書き込み時の処理を示す図である。It is a figure which shows the process at the time of the data writing which straddles the tail and head of the storage area in the variable-length record recording part as an example of 1st Embodiment. 第1実施形態の一例としての可変長レコード記録部におけるデータの読み出し時の処理を示すフローチャートである。It is a flowchart which shows the process at the time of the reading of the data in the variable-length record recording part as an example of 1st Embodiment. 第1実施形態の一例としてのシステム制御部を組み込んだ機器のハードウェア構成を示す模式図である。It is a schematic diagram which shows the hardware constitutions of the apparatus incorporating the system control part as an example of 1st Embodiment. 第2実施形態の一例としてのシステム制御部の構成を示す模式図である。It is a schematic diagram which shows the structure of the system control part as an example of 2nd Embodiment. 第2実施形態の一例としての可変長レコード記録部におけるデータの書き込み時の処理を示すフローチャートである。It is a flowchart which shows the process at the time of the data writing in the variable-length record recording part as an example of 2nd Embodiment. 前方データ長情報のみを有する可変長レコードの記録方式を示す図である。It is a figure which shows the recording system of the variable-length record which has only front data length information.
 以下、図面を参照して本開示に係る実施の形態を説明する。
(1)第1実施形態
 以下、図面を参照して、第1実施形態の一例としてのシステム制御部1の構成について説明する。
 図1は、第1実施形態の一例としてのシステム制御部1のハードウェア構成を示す模式図である。
Hereinafter, embodiments according to the present disclosure will be described with reference to the drawings.
(1) First Embodiment Hereinafter, a configuration of a system control unit 1 as an example of a first embodiment will be described with reference to the drawings.
FIG. 1 is a schematic diagram illustrating a hardware configuration of a system control unit 1 as an example of the first embodiment.
 システム制御部(記録装置)1は、例えば情報処理装置等であり、CPU(Central Processing Unit)5、RAM(Random Access Memory)7及び不揮発メモリ9を備える。
 CPU5は、RAM7や不揮発メモリ9からプログラムを読み出し、後述する可変長レコード記録部3としての処理を実行するプロセッサである。
 RAM(揮発記憶装置)7は、CPU5が演算や制御を行なうに際して、種々のデータやプログラムを一時的に格納する揮発メモリである。また、RAM7には、可変長レコード記録部3が使用する一時データ(図示なし)も記憶される。
The system control unit (recording device) 1 is, for example, an information processing device or the like, and includes a CPU (Central Processing Unit) 5, a RAM (Random Access Memory) 7, and a nonvolatile memory 9.
The CPU 5 is a processor that reads a program from the RAM 7 and the nonvolatile memory 9 and executes processing as a variable-length record recording unit 3 described later.
A RAM (volatile storage device) 7 is a volatile memory that temporarily stores various data and programs when the CPU 5 performs calculations and controls. The RAM 7 also stores temporary data (not shown) used by the variable length record recording unit 3.
 不揮発メモリ(不揮発記憶装置)9は、データを記憶するための記憶領域61を備える不揮発性の書き込み可能なメモリである。不揮発メモリ9は、例えば、EPROM(Erasable Programmable ROM)、EEPROM(Electrically Erasable Programmable ROM)、UV-EPROM(Ultra-Violet Erasable Programmable ROM)などである。しかし、不揮発メモリ9は、フラッシュメモリなど、他の書き込み可能な不揮発メモリでもよい。 The nonvolatile memory (nonvolatile storage device) 9 is a nonvolatile writable memory including a storage area 61 for storing data. The nonvolatile memory 9 is, for example, an EPROM (Erasable Programmable ROM), an EEPROM (Electrically Programmable ROM), a UV-EPROM (Ultra-Violet Programmable Programmable ROM), or the like. However, the nonvolatile memory 9 may be another writable nonvolatile memory such as a flash memory.
 以降、不揮発メモリ9に関して、「前方」とは不揮発メモリ9のアドレス値が小さくなる方向を、「後方」とは不揮発メモリ9のアドレス値が大きくなる方向をそれぞれ意味する。また、不揮発メモリ9の先頭とは、不揮発メモリ9の最小アドレス領域を、末尾又は最後尾とは、最大アドレス領域をそれぞれ意味する。
 ただし、これに限定されるものではなく、適宜変更して本実施形態を実施可能である。
Hereinafter, regarding the nonvolatile memory 9, “front” means a direction in which the address value of the nonvolatile memory 9 decreases, and “backward” means a direction in which the address value of the nonvolatile memory 9 increases. Further, the head of the nonvolatile memory 9 means the minimum address area of the nonvolatile memory 9, and the tail or tail means the maximum address area.
However, the present embodiment is not limited to this, and the present embodiment can be implemented with appropriate modifications.
 不揮発メモリ9は、記憶領域61を有し、記憶領域61は、先頭にデータ結合フラグ115(図4参照)を有する。このデータ結合フラグ115は、図7を参照して後述するように、データ結合フラグ設定部41によって設定される。
 可変長レコード記録部3は、CPU3で実行されている制御プログラム93や不図示のオペレーティングシステム(operating system:OS)からデータを受け取り、このデータを、不揮発メモリ9の記憶領域61にシーケンシャルに記録する。その際、可変長レコード記録部3は、図2を参照して説明するレコード構造(データセット)100を使用することにより、データの書き込みが記憶領域61の特定の部分に偏らないようにまんべんなく記憶する。
The nonvolatile memory 9 has a storage area 61, and the storage area 61 has a data combination flag 115 (see FIG. 4) at the head. The data combination flag 115 is set by the data combination flag setting unit 41 as described later with reference to FIG.
The variable-length record recording unit 3 receives data from a control program 93 executed by the CPU 3 or an operating system (OS) (not shown), and sequentially records this data in the storage area 61 of the nonvolatile memory 9. . At that time, the variable-length record recording unit 3 uses the record structure (data set) 100 described with reference to FIG. 2 to store data uniformly so that data writing is not concentrated on a specific part of the storage area 61. To do.
 図2は、第1実施形態の一例としてのシステム制御部1において使用されるレコード構造(データセット)100を示す図である。このレコード構造100を有する可変長データが、可変長レコード記録部3によって不揮発メモリ9の記憶領域61に記憶される。
 図2に示すレコード構造100は、先頭フラグ101、前方データ長(前方データ長情報、データ長1とも呼ぶ)103、ローテーションフラグ105、重複位置情報107、データ部109、最後尾フラグ111、及び後方データ長113(後方データ長情報、データ長2とも呼ぶ)を有する。
FIG. 2 is a diagram illustrating a record structure (data set) 100 used in the system control unit 1 as an example of the first embodiment. Variable length data having this record structure 100 is stored in the storage area 61 of the nonvolatile memory 9 by the variable length record recording unit 3.
The record structure 100 shown in FIG. 2 includes a head flag 101, a forward data length (forward data length information, also called data length 1) 103, a rotation flag 105, overlapping position information 107, a data portion 109, a tail flag 111, and a rear It has a data length 113 (rear data length information, also called data length 2).
 以降、レコードとは、このレコード構造100を有する1単位のデータを指す。
 先頭フラグ101は、レコード構造100の先頭を示すフラグであり、本例では例えば値“0”が設定される。先頭フラグ101は、例えば、1ビット長である。
 前方データ長103は、データ部109の長さを示す部分であり、ここには、後述する後方データ長113と同じ値が設定される。前方データ長103は、例えば、7ビット長である。なお、先頭フラグ101と前方データ長103とで1バイト長を占め、これらを総称して第1ヘッダバイト123と呼ぶ。
Hereinafter, a record refers to one unit of data having the record structure 100.
The head flag 101 is a flag indicating the head of the record structure 100. In this example, for example, a value “0” is set. The start flag 101 is, for example, 1 bit long.
The front data length 103 is a portion indicating the length of the data portion 109, and the same value as the rear data length 113 described later is set here. The forward data length 103 is, for example, 7 bits long. The head flag 101 and the forward data length 103 occupy 1 byte, and are collectively referred to as a first header byte 123.
 ローテーションフラグ105は、このレコードが、前回のローテーションで書き込まれるレコード(以下、旧レコード又は前回のレコードと呼ぶ)か、今回のローテーションで書き込まれたレコード(以下、新レコード又は今回のレコードと呼ぶ)かの判別に用いられる。ここで、ローテーションとは、記憶領域61の先頭から末尾までのシーケンシャルな1回の書き込みを指す。ローテーションフラグ105は、例えば、1ビット長である。前回のローテーションのレコードと今回のローテーションのレコードとを区別するために、ローテーションフラグ105に値“0”と“1”が、ローテーション毎に交互に設定される。 The rotation flag 105 indicates that this record is a record written in the previous rotation (hereinafter referred to as the old record or the previous record) or a record written in the current rotation (hereinafter referred to as the new record or the current record). This is used to determine whether Here, the rotation refers to one sequential write from the beginning to the end of the storage area 61. The rotation flag 105 is, for example, 1 bit long. In order to distinguish between the previous rotation record and the current rotation record, values “0” and “1” are alternately set in the rotation flag 105 for each rotation.
 重複位置情報107は、図3のように、書き込むデータの位置と旧レコードの前方データ長103の位置とが一致し、かつ書き込むデータと旧レコードの前方データ長103とが同じ値の場合(以下、この状況を重複という)に、その重複箇所の位置を示す。
 図3は、第1実施形態の一例における重複位置情報の使用法を示す図である。図3ではデータバイトを16進数で表記している。
As shown in FIG. 3, the overlapping position information 107 is such that the position of the data to be written matches the position of the forward data length 103 of the old record, and the data to be written and the forward data length 103 of the old record have the same value (hereinafter, , This situation is called duplication).
FIG. 3 is a diagram illustrating a method of using overlapping position information in an example of the first embodiment. In FIG. 3, data bytes are expressed in hexadecimal.
 書き込む新たなデータ部109内の1バイトの位置と旧レコードの前方データ長103の位置とが一致し、かつこのバイト(以下、重複バイトとも呼ぶ)と旧レコードの前方データ長103とが同じ値の場合、後述する重複位置情報生成部43が、当該重複バイトをビット反転する。
 例えば、図3に示す例では、旧レコードの先頭フラグ101が“0”、前方データ長103が“4”であるため、当該バイトの値が“0x04”(“0xXX”はバイトの16進数表記であり、X=0~F)であり、書き込もうとしているデータのデータ部109の2バイト目も“0x04”である。この場合、後述する重複位置情報生成部43は、新レコードのデータ部109の2バイト目の“0x04”をビット反転させて“0xFB”とする。更に、重複位置情報生成部43は、重複位置情報107に、データ部109内のビット反転させたバイトの位置(本例では2バイト目)である値“2”を設定する。
The position of 1 byte in the new data section 109 to be written matches the position of the forward data length 103 of the old record, and this byte (hereinafter also referred to as a duplicate byte) has the same value as the forward data length 103 of the old record. In this case, the duplication position information generation unit 43 described later inverts the duplication byte.
For example, in the example shown in FIG. 3, since the head flag 101 of the old record is “0” and the forward data length 103 is “4”, the byte value is “0x04” (“0xXX” is a hexadecimal representation of the byte). And X = 0 to F), and the second byte of the data portion 109 of the data to be written is also “0x04”. In this case, the duplication position information generation unit 43 to be described later reverses the bit “0x04” of the second byte of the data unit 109 of the new record to “0xFB”. Further, the duplication position information generation unit 43 sets a value “2” that is the bit position (second byte in this example) of the data portion 109 with the bit inverted in the duplication position information 107.
 なお、厳密には、書き込む新たなデータ部109のデータバイトと、旧レコードの第1ヘッダバイト123(先頭フラグ101+前方データ長103)とが比較されるが、本例では、先頭フラグ101に値“0”が設定されるため、前方データ長103と考えて差し支えない。このため、バイト位置の一致を、「書き込む新たなデータ部109の1バイトの位置と前方データ長103の位置とが一致する」と記載する。また、重複バイトと旧レコードの第1ヘッダバイト123との値の一致を「重複バイトと旧レコードの前方データ長103とが同じ値となる」と記載する。 Strictly speaking, the data byte of the new data portion 109 to be written is compared with the first header byte 123 (first flag 101 + forward data length 103) of the old record. Since “0” is set, the forward data length 103 can be considered. Therefore, the byte position match is described as “the position of 1 byte in the new data portion 109 to be written matches the position of the forward data length 103”. In addition, the coincidence between the value of the duplicate byte and the first header byte 123 of the old record is described as “the duplicate byte and the forward data length 103 of the old record have the same value”.
 このようなビット反転を行なうことで、書き込んだデータを後から読み出す際に、前方データ長103とデータ部との一致が原因で、新レコードが最新のデータではないと誤って判別されてしまう状況が回避される。更に、ビット反転させたバイトの位置を重複位置情報107に記録することで、後からデータを読み出す際に、元のバイト情報に復元することが可能となる。 By performing such bit inversion, when the written data is read later, it is erroneously determined that the new record is not the latest data due to the match between the forward data length 103 and the data portion. Is avoided. Furthermore, by recording the bit position that has been bit-reversed in the overlapping position information 107, it is possible to restore the original byte information when data is read later.
 重複位置情報107は、例えば、7ビット長である。なお、ローテーションフラグ105と重複位置情報107とで1バイト長を占め、これらを総称して第2ヘッダバイト125と呼ぶ。更に、第1ヘッダバイト123と第2ヘッダバイト125とをまとめてヘッダ部121と呼ぶ。
 データ部109は、データの内容を格納する可変長部分である。データ部109は、例えば、1~127バイト長である。
The overlapping position information 107 is, for example, 7 bits long. The rotation flag 105 and the overlapping position information 107 occupy 1 byte, and are collectively referred to as a second header byte 125. Further, the first header byte 123 and the second header byte 125 are collectively referred to as a header portion 121.
The data portion 109 is a variable length portion that stores data contents. The data portion 109 is, for example, 1 to 127 bytes long.
 最後尾フラグ111は、データの終わりであることを示すフラグであり、先頭フラグ101とは異なる値、例えば値“1”が設定される。最後尾フラグ111は、例えば、1ビット長である。このフラグは、図6の例(6)を用いて後述するように、旧レコードの前方データ長103と新レコードの後方データ長113との位置が重なっている場合に、新旧データ境界の判定誤りを防ぐために使用される。 The tail flag 111 is a flag indicating the end of data, and a value different from the head flag 101, for example, a value “1” is set. The tail flag 111 is, for example, 1 bit long. As will be described later with reference to the example (6) in FIG. 6, this flag indicates that the old / old data boundary determination error occurs when the front data length 103 of the old record and the rear data length 113 of the new record overlap. Used to prevent.
 後方データ長113は、データ部109の長さを示す部分であり、ここには、前述の前方データ長103と同じ値が設定される。後方データ長113は、例えば、7ビット長である。なお、最後尾フラグ111と後方データ長113とで1バイト長を占め、これらを総称してフッタ部127と呼ぶ。
 本実施形態においては、新しいデータを書き込む位置を特定するために、図2に示すように、データの先頭にデータ長情報を前方データ長103として設けるほか、データの後方にも後方データ長113を配置している。
The rear data length 113 is a portion indicating the length of the data portion 109, and here, the same value as that of the front data length 103 is set. The backward data length 113 is, for example, 7 bits long. The tail flag 111 and the backward data length 113 occupy 1 byte, and are collectively referred to as a footer unit 127.
In this embodiment, in order to specify the position where new data is written, as shown in FIG. 2, the data length information is provided as the front data length 103 at the head of the data, and the rear data length 113 is also provided behind the data. It is arranged.
 なお、図2に例示するデータ構造100の最小長は、データ部109の長さが1バイトの場合の4バイトである。
 可変長レコード記録部3は、記憶領域61にデータを、このレコード構造100の単位で書き込む。また、可変長レコード記録部3は、図4に示すように、例えば不揮発メモリ9の記憶領域61の先頭1バイトに、データ結合フラグ115を記憶する。例えば、データ結合フラグ115自体は1ビットの情報であり、残りの7ビットに“0”がパディングされる。
Note that the minimum length of the data structure 100 illustrated in FIG. 2 is 4 bytes when the length of the data portion 109 is 1 byte.
The variable-length record recording unit 3 writes data in the storage area 61 in units of this record structure 100. Further, as shown in FIG. 4, the variable-length record recording unit 3 stores a data combination flag 115 in the first 1 byte of the storage area 61 of the nonvolatile memory 9, for example. For example, the data combination flag 115 itself is 1-bit information, and “0” is padded to the remaining 7 bits.
 このデータ結合フラグ115は、記憶領域61の末尾の残り領域にデータが入りきらないため、データが二分割されて、記憶領域61の末尾と先頭とにまたがって記憶されていることを示すフラグである。データがまたがって記憶されている場合は、データ結合フラグ115に値“1”が設定される。なお、可変長レコード記録部3は、分割したデータのそれぞれにヘッダ部121及びフッタ部127を付加して2つのレコードを生成し、記憶領域61の末尾と先頭とにそれぞれ書き込む。この分割処理については、図7を用いて後述する。 The data combination flag 115 is a flag indicating that the data is divided into two parts and stored across the end and the head of the storage area 61 because the data does not completely enter the remaining area at the end of the storage area 61. is there. When data is stored across the memory, the value “1” is set in the data combination flag 115. The variable-length record recording unit 3 adds the header part 121 and the footer part 127 to each of the divided data, generates two records, and writes them at the end and the top of the storage area 61, respectively. This division processing will be described later with reference to FIG.
 図4は、第1実施形態の一例としてのシステム制御部1の機能構成を示す模式図である。
 図4に示すように、RAM7は、上書き位置記憶部51、一時レコード記憶部53及びローテーションフラグ記憶部55を有する。
 上書き位置記憶部51は、後述する上書き位置を記憶する領域である。
FIG. 4 is a schematic diagram illustrating a functional configuration of the system control unit 1 as an example of the first embodiment.
As illustrated in FIG. 4, the RAM 7 includes an overwrite position storage unit 51, a temporary record storage unit 53, and a rotation flag storage unit 55.
The overwrite position storage unit 51 is an area for storing an overwrite position described later.
 一時レコード記憶部53は、データを不揮発メモリ9の記憶部61に書き込む際に一時的に使用される領域である。
 ローテーションフラグ記憶部55は、ローテーションフラグ107(図2参照)に設定する値を記憶する領域である。
 CPU5は、RAM7等に記憶されている不図示の可変長レコード記録プログラムを実行することにより、可変長レコード記録部3を実現する処理装置である。
The temporary record storage unit 53 is an area temporarily used when data is written to the storage unit 61 of the nonvolatile memory 9.
The rotation flag storage unit 55 is an area for storing a value set in the rotation flag 107 (see FIG. 2).
The CPU 5 is a processing device that realizes the variable-length record recording unit 3 by executing a variable-length record recording program (not shown) stored in the RAM 7 or the like.
 可変長レコード記録部3は、最古レコード特定部11、最新レコード特定部13、書き込み部15、及び読み出し部17を有する。
 最古レコード特定部11は、不揮発メモリ9の記憶領域61を最後尾(第2の記録位置;末尾)から先頭(第1の記録位置)に向けて前方に辿り、記憶領域61に記憶されているレコードのうち、読み出し可能な最古のレコードを特定する。最古レコード特定部11は、後方データ長113に基づいて前方データ長103を読み出し、前方データ長103と後方データ長113との値の不一致から、最新のレコードと最も古いレコードとの境界(以下、この境界を、第1の記録領域、又はデータ境界位置、又は上書き位置とも呼ぶ)の位置を特定する。
The variable-length record recording unit 3 includes an oldest record specifying unit 11, a latest record specifying unit 13, a writing unit 15, and a reading unit 17.
The oldest record specifying unit 11 traces the storage area 61 of the nonvolatile memory 9 forward from the tail (second recording position; tail) to the head (first recording position), and is stored in the storage area 61. The oldest record that can be read is specified. The oldest record specifying unit 11 reads the forward data length 103 based on the backward data length 113, and the boundary between the latest record and the oldest record (hereinafter referred to as the oldest record) from the mismatch of the forward data length 103 and the backward data length 113. The boundary is also referred to as a first recording area, data boundary position, or overwrite position).
 最古レコード特定部11は、レコード走査部21、データ長取得部23、データ長比較部25、ローテーションフラグ比較部27及び先頭/最後尾フラグ判定部29を有する。
 レコード走査部21は、不揮発メモリ9の記憶領域61の末尾から前方に向かって順にレコードを1つずつ辿り、後方データ長113を読み出す。例えば、レコード走査部21は、次の(1つ古い)レコードに移動する際に、記憶領域61の(読み出した後方データ長113の値+3)バイト前方の領域を、次のレコードの後方データ長113の値として読み出す。
The oldest record specifying unit 11 includes a record scanning unit 21, a data length acquisition unit 23, a data length comparison unit 25, a rotation flag comparison unit 27, and a head / tail flag determination unit 29.
The record scanning unit 21 sequentially reads records one by one from the end of the storage area 61 of the nonvolatile memory 9 toward the front, and reads the rear data length 113. For example, when the record scanning unit 21 moves to the next (one older) record, the record data in the storage area 61 (the value of the read back data length 113 +3) bytes ahead is used as the back data length of the next record. Read as the value of 113.
 データ長取得部23は、レコード走査部21が読み出した後方データ長113に基づいて前方データ長103を読み出す。例えば、データ長取得部23は、記憶領域61の(レコード走査部21が読み出した後方データ長113の値+1)バイト前方の領域を、前方データ長103として読み出す。
 データ長比較部25は、レコード走査部21が読み出した前方データ長103と後方データ長113とを比較して、両者が一致するかどうかを比較し、前方データ長103と後方データ長113とが一致しない場合、そのレコード位置を、RAM7の上書き位置記憶部51に記憶する。
The data length acquisition unit 23 reads the front data length 103 based on the rear data length 113 read by the record scanning unit 21. For example, the data length acquisition unit 23 reads, as the front data length 103, an area ahead of the storage area 61 (the value of the rear data length 113 read by the record scanning unit 21 + 1) bytes.
The data length comparison unit 25 compares the forward data length 103 read by the record scanning unit 21 with the backward data length 113 to determine whether they match, and the forward data length 103 and backward data length 113 are compared. If they do not match, the record position is stored in the overwrite position storage unit 51 of the RAM 7.
 ローテーションフラグ比較部27は、レコード走査部21が読み出しているレコードのローテーションフラグ107と、その前の(1つ新しい)レコードのローテーションフラグ107とを比較する。この処理の詳細は、図6の例(3)を用いて後述する。
 先頭/最後尾フラグ判定部29は、前方データ長103の前の先頭フラグ101や、後方データ長113の前の最後尾フラグ111の値が“0”か“1”であるかを判定する。
The rotation flag comparison unit 27 compares the rotation flag 107 of the record read by the record scanning unit 21 with the rotation flag 107 of the previous (one new) record. Details of this processing will be described later using an example (3) in FIG.
The head / tail flag determination unit 29 determines whether the value of the head flag 101 before the forward data length 103 and the value of the tail flag 111 before the rear data length 113 are “0” or “1”.
 最新レコード特定部13は、不揮発メモリ9の記憶領域61を先頭から辿り、記憶領域61に記憶されているレコードのうち、最も新しい最新レコードの位置を特定する。
 最新レコード特定部13は、前方データ長103に基づいて、最古レコード特定部11が特定したデータ境界位置(上書き位置)まで、記憶領域61の前方から後方に辿り、次にデータの書き込みを行なう位置(次のデータセットの記録開始位置;第2の記録領域)を特定する。
The latest record specifying unit 13 traces the storage area 61 of the nonvolatile memory 9 from the top and specifies the position of the newest latest record among the records stored in the storage area 61.
Based on the forward data length 103, the latest record specifying unit 13 follows from the front of the storage area 61 to the data boundary position (overwrite position) specified by the oldest record specifying unit 11, and then writes data. The position (recording start position of the next data set; second recording area) is specified.
 最新レコード特定部13は、レコード走査部31、データ長取得部33、及び最新レコード位置特定部35を有する。
 レコード走査部31は、不揮発メモリ9の記憶領域61の先頭から後方に向かって順にレコードを1つずつ辿り、前方データ長103を読み出す。例えば、レコード走査部31は、次の(1つ新しい)レコードに移動する際に、記憶領域61の(読み出した前方データ長103の値+3)バイト後方の領域を、次のレコードの前方データ長103の値として読み出す。
The latest record specifying unit 13 includes a record scanning unit 31, a data length acquisition unit 33, and a latest record position specifying unit 35.
The record scanning unit 31 traces records one by one in order from the top to the back of the storage area 61 of the nonvolatile memory 9, and reads the forward data length 103. For example, when the record scanning unit 31 moves to the next (one new) record, the record scanning unit 31 sets the area behind (the value of the read forward data length 103 +3) bytes in the forward data length of the next record. Read as a value of 103.
 データ長取得部33は、レコード走査部31が読み出した前方データ長103に基づいて後方データ長113を読み出す。例えば、データ長取得部33は、記憶領域61の(レコード走査部31が読み出した前方データ長103の値+1)バイト後方の領域を、後方データ長113として読み出す。
 最新レコード位置特定部35は、レコード走査部31が読み出した前方データ長103、データ長取得部33が読み出した後方データ長113、及びRAM7の上書き位置記憶部51に記憶されている値を比較して、前方データ長103と後方データ長113との間に、RAM7の上書き位置記憶部51に記憶されている上書き位置が入っているかどうかを判定する。
The data length acquisition unit 33 reads the rear data length 113 based on the front data length 103 read by the record scanning unit 31. For example, the data length acquisition unit 33 reads a region behind the storage region 61 (the value of the forward data length 103 read by the record scanning unit 31 + 1) bytes as the backward data length 113.
The latest record position specifying unit 35 compares the forward data length 103 read by the record scanning unit 31, the backward data length 113 read by the data length acquisition unit 33, and the value stored in the overwrite position storage unit 51 of the RAM 7. Thus, it is determined whether or not the overwrite position stored in the overwrite position storage unit 51 of the RAM 7 is between the forward data length 103 and the backward data length 113.
 書き込み部15は、不揮発メモリ9の記憶領域61へのレコードの書き込みを行なう。詳細には、書き込み部15は、RAM7の一時レコード記憶部53に一時レコードを生成し、レコードの生成が終了したら一時レコード記憶部53から記憶領域61にデータを転送する。
 書き込み部15は、データ結合フラグ設定部41、重複位置情報生成部43、ローテーションフラグ設定部45、及びレコード転送部47を有する。
The writing unit 15 writes a record to the storage area 61 of the nonvolatile memory 9. Specifically, the writing unit 15 generates a temporary record in the temporary record storage unit 53 of the RAM 7 and transfers data from the temporary record storage unit 53 to the storage area 61 when the generation of the record is completed.
The writing unit 15 includes a data combination flag setting unit 41, an overlapping position information generation unit 43, a rotation flag setting unit 45, and a record transfer unit 47.
 データ結合フラグ設定部41は、図7に示すように、記憶領域61の末尾にデータが入りきらない場合に、データを二分割すると共に、データ結合フラグ115(図3参照)に値“1”を設定する。
 重複位置情報生成部43は、前述のように、書き込む新たなデータ部109内の1バイトの位置と旧レコードの前方データ長103の位置とが一致し(重複し)、かつ新データと旧レコードの前方データ長103とが同じ値の場合、当該重複バイトをビット反転させる。また、重複位置情報生成部43は、データ部109の先頭を基準とした、データ部109中のビット反転させたバイトの位置を、重複位置情報107に記録する。
As shown in FIG. 7, the data combination flag setting unit 41 divides the data into two when the data does not fit at the end of the storage area 61 and sets the value “1” in the data combination flag 115 (see FIG. 3). Set.
As described above, the duplicate position information generation unit 43 matches the position of 1 byte in the new data part 109 to be written with the position of the forward data length 103 of the old record (overlap), and the new data and the old record. When the forward data length 103 is the same value, the duplicate byte is bit-inverted. In addition, the overlapping position information generation unit 43 records the position of the bit-inverted byte in the data portion 109 with reference to the head of the data portion 109 in the overlapping position information 107.
 例えば、前述の如く、図3に示す例では、旧レコードの先頭フラグ101が“0”、前方データ長103が“4”であるため、第1ヘッダバイト123の値が“0x04”であり、書き込もうとしているデータのデータ部109の2バイト目も“0x04”である。この場合、後述する重複位置情報生成部43は、データ部109の2バイト目の“0x04”をビット反転させて“0xFB”とする。更に、重複位置情報生成部43は、重複位置情報107に、データ部109内のビット反転させたバイトの位置(本例では2バイト目)である値“2”を設定する。 For example, as described above, in the example shown in FIG. 3, the value of the first header byte 123 is “0x04” because the top flag 101 of the old record is “0” and the forward data length 103 is “4”. The second byte of the data portion 109 of the data to be written is also “0x04”. In this case, the duplication position information generation unit 43 described later inverts the bit “0x04” of the second byte of the data unit 109 to “0xFB”. Further, the duplication position information generation unit 43 sets a value “2” that is the bit position (second byte in this example) of the data portion 109 with the bit inverted in the duplication position information 107.
 ローテーションフラグ設定部45は、RAM7のローテーションフラグ記憶部55に記憶されているローテーションフラグの値を、書き込むデータのローテーションフラグ107に設定する。また、ローテーションフラグ設定部45は、例えば、書き込み位置が記憶領域61の先頭に戻った際に、RAM7のローテーションフラグ記憶部55の値を反転させる。 The rotation flag setting unit 45 sets the rotation flag value stored in the rotation flag storage unit 55 of the RAM 7 to the rotation flag 107 of the data to be written. Also, the rotation flag setting unit 45 inverts the value of the rotation flag storage unit 55 of the RAM 7 when the write position returns to the top of the storage area 61, for example.
 レコード転送部47は、書き込むデータを制御プログラム93や不図示のOSから受け取り、このデータに基づいて、レコード構造100を生成し、一時レコード記憶部53に記憶する。更にレコード転送部47は、データ結合フラグ設定部41、重複位置情報生成部43、及びローテーションフラグ設定部45の処理が完了し、一時レコード記憶部53内の一時レコードが完成すると、これを記憶領域61に転送する。 The record transfer unit 47 receives data to be written from the control program 93 or an OS (not shown), generates a record structure 100 based on this data, and stores it in the temporary record storage unit 53. Further, the record transfer unit 47 completes the processing of the data combination flag setting unit 41, the overlapping position information generation unit 43, and the rotation flag setting unit 45, and when the temporary record in the temporary record storage unit 53 is completed, Forward to 61.
 読み出し部17は、記憶領域61に書き込まれているレコードを古い順から読み出す。
 次に、第1実施形態の一例としての可変長レコード記録部3におけるデータの書き込み時の処理を説明する。
 図5は、第1実施形態の一例としての可変長レコード記録部3におけるデータの書き込み時の処理を示すフローチャートである。
The reading unit 17 reads the records written in the storage area 61 from the oldest order.
Next, processing at the time of data writing in the variable-length record recording unit 3 as an example of the first embodiment will be described.
FIG. 5 is a flowchart showing processing at the time of data writing in the variable-length record recording unit 3 as an example of the first embodiment.
 この書き込みは、例えば、CPU5で実行されている制御プログラム93から不揮発メモリ9の記憶領域61にデータ(ログデータなど)を書き込む際に行なわれる。
 ステップS1において、不揮発メモリ9の記憶領域61の末尾のレコードに移動する。
 ステップS3において、データ長取得部23は、レコード走査部21は、カレントレコードの後方データ長113を読み出す。
This writing is performed, for example, when data (such as log data) is written into the storage area 61 of the nonvolatile memory 9 from the control program 93 executed by the CPU 5.
In step S1, the process moves to the last record in the storage area 61 of the nonvolatile memory 9.
In step S3, the data length acquisition unit 23 reads the rear data length 113 of the current record from the record scanning unit 21.
 ステップS5において、データ長取得部23は、ステップS3で読み出した後方データ長113に基づいて、レコードの前方データ長103を読み出す。
 ステップS9において、データ長比較部25は、ステップS3で読み出した後方データ長113と、ステップS5で読み出した前方データ長103とが等しいかどうかを判定する。
In step S5, the data length acquisition unit 23 reads the forward data length 103 of the record based on the backward data length 113 read in step S3.
In step S9, the data length comparison unit 25 determines whether the backward data length 113 read in step S3 is equal to the forward data length 103 read in step S5.
 ステップS9で後方データ長113と前方データ長103とが等しい場合(ステップS9のYESルート参照)、ステップS11において、ローテーションフラグ比較部27は、レコード走査部21が読み出したカレントのレコードとその前の(1つ新しい)レコードのローテーションフラグ107同士が一致するか判定する。
 ステップS11でローテーションフラグ107が一致しない場合(ステップS11のNOルート参照)、ステップS13において、先頭/最後尾フラグ判定部29は、前方データ長103の前の先頭ビット101の値が“0”に設定されているかどうかを判定する。
When the backward data length 113 and the forward data length 103 are equal in step S9 (see YES route in step S9), in step S11, the rotation flag comparison unit 27 reads the current record read by the record scanning unit 21 and the preceding record. It is determined whether the rotation flags 107 of the (one new) records match.
If the rotation flag 107 does not match in step S11 (see the NO route in step S11), in step S13, the head / tail flag determination unit 29 sets the value of the head bit 101 before the forward data length 103 to “0”. Determine whether it is set.
 ステップS13で前方データ長103の前の先頭ビット101の値が“0”の場合(ステップS13のYESルート参照)、ステップS15において、データ長比較部25は、後方データ長113と前方データ長103とが不一致のレコードを、最新レコードの存在する位置と判断する。つまり、この位置で最新のレコードが書き込まれたことにより、旧レコードの前方データ長103が上書きされて、前方データ長103と後方データ長113の値とが一致しなくなっている。このため、データ長比較部25は、直前に前方データ長103と後方データ長113が一致していたレコードが、最も古いレコードであると判定する。 When the value of the first bit 101 before the forward data length 103 is “0” in step S13 (see YES route in step S13), in step S15, the data length comparison unit 25 determines the backward data length 113 and the forward data length 103. The record that does not match is determined as the position where the latest record exists. That is, when the latest record is written at this position, the forward data length 103 of the old record is overwritten, and the values of the forward data length 103 and the backward data length 113 do not match. For this reason, the data length comparison unit 25 determines that the record in which the front data length 103 and the rear data length 113 coincide immediately before is the oldest record.
 また、データ長比較部25は、前方データ長103と後方データ長113の値が一致しない最新レコード(以下、上書き位置と呼ぶこともある)の位置を、RAM7の上書き位置記憶部51に記憶する。この位置は、最新レコード特定部13による前方からの検索で使用される。
 一方、ステップS9において、ステップS3で読み出した後方データ長113と、ステップS5で読み出した前方データ長103とが不一致の場合(ステップS9のNOルート参照)、処理がステップS15に移る。
Further, the data length comparison unit 25 stores the position of the latest record (hereinafter also referred to as an overwrite position) in which the values of the forward data length 103 and the backward data length 113 do not match in the overwrite position storage unit 51 of the RAM 7. . This position is used in the search from the front by the latest record specifying unit 13.
On the other hand, if the backward data length 113 read in step S3 and the forward data length 103 read in step S5 do not match in step S9 (see NO route in step S9), the process proceeds to step S15.
 また、ステップS11でローテーションフラグ107が一致する場合(ステップS11のYESルート参照)、処理がステップS7に移る。
 ステップS13で前方データ長103の前の先頭ビット101の値が“0”ではない場合(ステップS13のNOルート参照)、ステップS7において、レコード走査部21は、不揮発メモリ9の記憶領域61の1つ前のレコード(次に古い)レコードに移り、その後方データ長113を読み出す。
If the rotation flag 107 matches in step S11 (see YES route in step S11), the process proceeds to step S7.
When the value of the first bit 101 before the forward data length 103 is not “0” in step S13 (see the NO route in step S13), the record scanning unit 21 sets 1 in the storage area 61 of the nonvolatile memory 9 in step S7. Moves to the previous record (next oldest) record, and the backward data length 113 is read.
 ステップS15に達するまで、上記ステップS3~ステップS13の処理を繰り返す。
 次に、ステップS17において、レコード走査部31は、不揮発メモリ9の記憶領域61の先頭のレコードに移動してその前方データ長103を読み出す。
 次に、ステップS19において、データ長取得部33は、ステップS17で読み出した前方データ長103に基づいて、そのレコードの後方データ長113を読み出す。
Until the process reaches step S15, the processes of steps S3 to S13 are repeated.
Next, in step S <b> 17, the record scanning unit 31 moves to the first record in the storage area 61 of the nonvolatile memory 9 and reads the forward data length 103.
Next, in step S19, the data length acquisition unit 33 reads the rear data length 113 of the record based on the front data length 103 read in step S17.
 次に、ステップS21において、最新レコード位置特定部35は、ステップS17で読み出した前方データ長103と、ステップ8で読み出した後方データ長113との間に、上書き位置記憶部51に記憶させた位置(上書き位置)が含まれるかどうかを判定する。
 前方データ長103と後方データ長113との間に上書き位置が含まれない場合(ステップS21のNOルート参照)は、記憶領域61の前方読み出しにおいて、上書き位置をまだ通過していない。このため、ステップS23において、レコード走査部31は、1つ後ろのレコード(新しいレコード)に移動して、そのレコードの前方データ長103を読み出す。
Next, in step S21, the latest record position specifying unit 35 stores the position stored in the overwrite position storage unit 51 between the forward data length 103 read in step S17 and the backward data length 113 read in step 8. It is determined whether (overwrite position) is included.
When the overwrite position is not included between the forward data length 103 and the backward data length 113 (see NO route in step S21), the overwrite position has not yet been passed in the forward reading of the storage area 61. For this reason, in step S23, the record scanning unit 31 moves to the next record (new record) and reads the forward data length 103 of the record.
 ステップS21の判定において、前方データ長103と後方データ長113との間に上書き位置が含まれるまで、上記ステップS19~ステップS23の処理を繰り返す。
 ステップS21の判定において前方データ長103と後方データ長113との間に上書き位置が含まれる場合(ステップS21のYESルート参照)、処理が書き込み処理に移る。カレントレコードが最新のレコードとなり、次の書き込み位置は、最新レコードの次の位置となる。
In the determination in step S21, the processes in steps S19 to S23 are repeated until an overwrite position is included between the forward data length 103 and the backward data length 113.
If the overwriting position is included between the front data length 103 and the rear data length 113 in the determination in step S21 (see YES route in step S21), the processing shifts to writing processing. The current record becomes the latest record, and the next write position is the position next to the latest record.
 ステップS25において、次に書き込むデータ部109内の1バイトのバイトの位置と、最も古いレコードの前方データ長103の位置とが一致し、かつ両者の値が一致するかどうかを判定する。例えば、図3の例では、書き込もうとしているデータ(データ部109)の2バイト目(値“0x04”)の位置と、旧データの前方データ長103(値“4”)の位置とが一致し、かつ両者が同じ値である。 In step S25, it is determined whether the position of the 1-byte byte in the data section 109 to be written next matches the position of the forward data length 103 of the oldest record, and whether both values match. For example, in the example of FIG. 3, the position of the second byte (value “0x04”) of the data to be written (data portion 109) and the position of the forward data length 103 (value “4”) of the old data are one. And both are the same value.
 次に書き込むレコードのデータ部109内の1バイトの位置と、最も古いレコードの前方データ長103の位置とが一致し、かつ両者の値が一致する場合(ステップS25のYESルート参照)、ステップS27において、重複位置情報生成部43は、重複位置のデータをビット反転する。更に、重複位置情報生成部43は、ビット反転させた位置(レコード内のデータ部の先頭バイトを1とした相対位置)を、RAM7の一時レコード記憶部53の重複位置情報107に設定する。 If the position of 1 byte in the data portion 109 of the record to be written next matches the position of the forward data length 103 of the oldest record and the values of both coincide (see YES route in step S25), step S27 The overlap position information generation unit 43 bit-inverts the overlap position data. Further, the duplication position information generation unit 43 sets the bit-inverted position (relative position where the first byte of the data part in the record is 1) in the duplication position information 107 of the temporary record storage unit 53 of the RAM 7.
 例えば、前述のごとく、図3の例では、重複位置情報生成部43は、書き込むデータの2バイト目の“0x04“をビット反転させた“0xFB”を、RAM7の一時レコード記憶部53のデータ部109の2バイト目に書き込む。更に、重複位置情報生成部43は、一時レコード記憶部53の重複位置情報107に、ビット反転させたバイト位置の“2”を書き込む。 For example, as described above, in the example of FIG. 3, the overlapping position information generation unit 43 sets “0xFB” obtained by bit-inverting “0x04” of the second byte of the data to be written to the data portion of the temporary record storage unit 53 of the RAM 7. Write to the second byte of 109. Further, the duplication position information generation unit 43 writes “2” of the byte position with the bit inverted in the duplication position information 107 of the temporary record storage unit 53.
 一方、次に書き込むレコードのデータ部109内の1バイトの位置と、最も古いレコードの前方データ長103の位置とが一致しないか、あるいは一致しても両者の値が異なる場合(ステップS25のNOルート参照)、処理はステップS29に移る。
 最後に、ステップS29において、レコード転送部47は、前方データ長103、後方データ長113、ローテーションフラグ105をRAM7の一時レコード記憶部53に書き込む。そして、レコードを、不揮発メモリ9の記憶領域61の書き込み位置に転送し、不揮発メモリ9へのレコードの書き込みを行なう。
On the other hand, if the position of 1 byte in the data portion 109 of the record to be written next does not match the position of the forward data length 103 of the oldest record, or the two values differ even if they match (NO in step S25) The process proceeds to step S29.
Finally, in step S29, the record transfer unit 47 writes the forward data length 103, the backward data length 113, and the rotation flag 105 in the temporary record storage unit 53 of the RAM 7. Then, the record is transferred to the write position in the storage area 61 of the nonvolatile memory 9 and the record is written to the nonvolatile memory 9.
 次に、図6を参照して、可変長レコード記録部3におけるさまざまなデータの書き込み例を更に詳しく説明する。
 図6は、第1実施形態の一例としての可変長レコード記録部3におけるさまざまなデータの書き込み例を示す図である。
 なお、図6中、破線の矢印は不揮発メモリ9の記憶領域61への最初一巡目の書き込みを示し、実線の矢印は二巡目の書き込みを示す。また、左斜め下向きの斜線の部分は第1ヘッダバイト123を示す。横線の部分は、第2ヘッダバイト125を示す。更に、右斜め下向きの斜線部分は、フッタ部127を示す。また、図6ではデータバイトを16進数で表記している。
Next, examples of writing various data in the variable-length record recording unit 3 will be described in more detail with reference to FIG.
FIG. 6 is a diagram illustrating various data writing examples in the variable-length record recording unit 3 as an example of the first embodiment.
In FIG. 6, the dashed arrow indicates the first round of writing to the storage area 61 of the nonvolatile memory 9, and the solid line arrow indicates the second round of writing. Also, the diagonally downward slanting portion on the left indicates the first header byte 123. The horizontal line portion indicates the second header byte 125. Further, the diagonally downward hatched portion on the right indicates a footer portion 127. In FIG. 6, data bytes are expressed in hexadecimal.
 図6の例(1)は、記憶領域61に初めて(一巡目の)データを記録する際の処理を示す。
 まず、ローテーションフラグ設定部45が、RAM7のローテーションフラグ記憶部55に値“0”を設定する。
 次に、記憶領域61に、データ結合フラグ115、レコードa、レコードb、レコードc、レコードdが順に書き込まれる。データ部109の長さがレコードaは3バイト、レコードbは4バイト、レコードcは2バイト、レコードdは1バイトである。その際、レコードa~dのローテーションフラグ105には、RAM7のローテーションフラグ記憶部55に記憶されている値“0”が書き込まれ、重複位置情報107は、重複位置が存在しないため値“0”が書き込まれる。このため、第2ヘッダバイト125の値が“0x00”となる。また、レコードのフッタ部127には、“0x83”、“0x84”、“0x82”及び“0x82”がそれぞれ書き込まれる。
The example (1) in FIG. 6 shows processing when data is recorded for the first time (first round) in the storage area 61.
First, the rotation flag setting unit 45 sets a value “0” in the rotation flag storage unit 55 of the RAM 7.
Next, the data combination flag 115, the record a, the record b, the record c, and the record d are sequentially written in the storage area 61. The length of the data portion 109 is 3 bytes for record a, 4 bytes for record b, 2 bytes for record c, and 1 byte for record d. At this time, the value “0” stored in the rotation flag storage unit 55 of the RAM 7 is written to the rotation flag 105 of the records a to d, and the overlap position information 107 has the value “0” because there is no overlap position. Is written. Therefore, the value of the second header byte 125 is “0x00”. Further, “0x83”, “0x84”, “0x82”, and “0x82” are respectively written in the footer portion 127 of the record.
 レコードdを記録すると、記憶領域61の末尾に達する。このため、次の例(2)では、ローテーションフラグ記憶部55が、ローテーションの入れ替わりを示すために、RAM7のローテーションフラグ記憶部55に記憶されている値“0”を反転させた値“1”をセットする。そして、例(2)に示すように、記憶領域61のデータ結合フラグ115の直後に、データ部109の長さが1の新レコードeが書き込まれる。 When the record d is recorded, the end of the storage area 61 is reached. Therefore, in the next example (2), the rotation flag storage unit 55 inverts the value “0” stored in the rotation flag storage unit 55 of the RAM 7 in order to indicate the rotation change. Set. Then, as shown in Example (2), immediately after the data combination flag 115 in the storage area 61, a new record e having a length of 1 in the data portion 109 is written.
 その際、レコードeのローテーションフラグ105には、ローテーションフラグ記憶部55に記憶されている値“1”が書き込まれ、重複位置情報107には、重複位置が存在しないため値“0”が書き込まれる。このため、第2ヘッダバイト125の値が“0x80”となる。
 その後、最古レコード特定部11は、左向きの矢印で示すように、記憶領域61の末尾からレコードを前方に辿っていく。データ長比較部25が、上書きされたレコードaの後方データ長113の値“3”と、レコードeの前方データ長103の値“1”とが不一致であるため、新旧のデータの境目がこの周辺に存在すると判定する。
At this time, the value “1” stored in the rotation flag storage unit 55 is written to the rotation flag 105 of the record e, and the value “0” is written to the overlap position information 107 because there is no overlap position. . Therefore, the value of the second header byte 125 is “0x80”.
Thereafter, the oldest record specifying unit 11 traces the record forward from the end of the storage area 61 as indicated by a left-pointing arrow. Since the value “3” of the backward data length 113 of the overwritten record “a” and the value “1” of the forward data length 103 of the record “e” do not match, the data length comparison unit 25 defines the boundary between the old and new data. It is determined that it exists in the vicinity.
 次の例(3)では、記憶領域61のデータ結合フラグ115の直後に、データ部109の長さが2の新レコードeが書き込まれる。
 その際、レコードeのローテーションフラグ105には、ローテーションフラグ記憶部55に記憶されている値“1”が書き込まれ、重複位置情報107には、重複位置が存在しないため値“0”が書き込まれる。このため、第2ヘッダバイト125の値が“0x80”となる。
In the next example (3), immediately after the data combination flag 115 in the storage area 61, a new record e having a length of 2 in the data portion 109 is written.
At this time, the value “1” stored in the rotation flag storage unit 55 is written to the rotation flag 105 of the record e, and the value “0” is written to the overlap position information 107 because there is no overlap position. . Therefore, the value of the second header byte 125 is “0x80”.
 その後、最古レコード特定部11は、左向きの矢印で示すように、記憶領域61の末尾からレコードを前方に辿っていく。データ長比較部25が、上書きされたレコードaの後方データ長113の値“3”と、レコードeの後方データ長113の値“2”とが不一致であるため、新旧のデータの境目がこの周辺に存在すると判定する。
 次の例(4)は、古いレコードの前方データ長103と新しいレコードの前方データ長103の位置が重なっている別のケースである。例(4)に示すように、記憶領域61のデータ結合フラグ115の直後に、データ部109の長さが3の新レコードeが書き込まれる。
Thereafter, the oldest record specifying unit 11 traces the record forward from the end of the storage area 61 as indicated by a left-pointing arrow. Since the value “3” of the backward data length 113 of the overwritten record “a” does not match the value “2” of the backward data length 113 of the record “e”, the data length comparison unit 25 defines the boundary between the old and new data. It is determined that it exists in the vicinity.
The next example (4) is another case where the position of the forward data length 103 of the old record and the forward data length 103 of the new record overlap. As shown in the example (4), immediately after the data combination flag 115 in the storage area 61, a new record e having a length of 3 in the data portion 109 is written.
 その際、レコードeのローテーションフラグ105には、ローテーションフラグ記憶部55に記憶されている値“1”が書き込まれ、重複位置情報107には、重複位置が存在しないため値“0”が書き込まれる。このため、第2ヘッダバイト125の値が“0x80”となる。
 その後、最古レコード特定部11は、左向きの矢印で示すように、記憶領域61の末尾からレコードを前方に辿っていく。データ長比較部25が、上書きされたレコードaの後方データ長113の値“3”と、レコードeの後方データ長113の値“3”とが一致すると判定する。しかし、×で示すように、レコードaより1つ新しいレコードbのローテーションフラグ105の値“0”と、レコードeのローテーションフラグ105の値“1”とが一致しない。このため、新旧のデータの境目がこの部分に存在すると判定される。このように、新旧のデータの前方データ長103と後方データ長113とが一致する場合であっても、ローテーションフラグ比較部27がローテーションフラグを比較することにより、レコードbの方が古いデータであることを判別することができる。
At this time, the value “1” stored in the rotation flag storage unit 55 is written to the rotation flag 105 of the record e, and the value “0” is written to the overlap position information 107 because there is no overlap position. . Therefore, the value of the second header byte 125 is “0x80”.
Thereafter, the oldest record specifying unit 11 traces the record forward from the end of the storage area 61 as indicated by a left-pointing arrow. The data length comparison unit 25 determines that the value “3” of the backward data length 113 of the overwritten record a matches the value “3” of the backward data length 113 of the record e. However, as indicated by x, the value “0” of the rotation flag 105 of the record b one newer than the record a does not match the value “1” of the rotation flag 105 of the record e. For this reason, it is determined that the boundary between the old and new data exists in this portion. Thus, even when the forward data length 103 and the backward data length 113 of the old and new data match, the rotation flag comparison unit 27 compares the rotation flags, so that the record b is the older data. Can be determined.
 次の例(5)は、古いレコードの前方データ長103と新しいレコードの後方データ長113の位置が重なっているケースである。例(5)に示すように、記憶領域61のデータ結合フラグ115の直後に、データ部109の長さが4の新レコードeが書き込まれる。
 その際、レコードeのローテーションフラグ105には、ローテーションフラグ記憶部55に記憶されている値“1”が書き込まれ、重複位置情報107には、重複位置が存在しないため値“0”が書き込まれる。このため、第2ヘッダバイト125の値が“0x80”となる。
The next example (5) is a case where the positions of the forward data length 103 of the old record and the backward data length 113 of the new record overlap. As shown in example (5), immediately after the data combination flag 115 in the storage area 61, a new record e having a length of 4 in the data portion 109 is written.
At this time, the value “1” stored in the rotation flag storage unit 55 is written to the rotation flag 105 of the record e, and the value “0” is written to the overlap position information 107 because there is no overlap position. . Therefore, the value of the second header byte 125 is “0x80”.
 その後、最古レコード特定部11は、左向きの矢印で示すように、記憶領域61の末尾からレコードを前方に辿っていく。データ長比較部25が、レコードeの後方データ長113の値を、前方データ長103であると誤って認識し、後方データ長113の値“4”が上書きされたレコードbの後方データ長113の値“4”と一致すると判定してしまう。 Thereafter, the oldest record specifying unit 11 traces the record forward from the end of the storage area 61 as indicated by the left-pointing arrow. The data length comparison unit 25 erroneously recognizes the value of the backward data length 113 of the record e as the forward data length 103, and the backward data length 113 of the record b in which the value “4” of the backward data length 113 is overwritten. It is determined that the value matches the value “4”.
 しかし、先頭/最後尾フラグ判定部29が、上書きされたレコードbの後方データ長113の値“4”の1つ前のフラグの値が“1”であり、比較したのが前方データ長103ではなく後方データ長113であると判定するので、新旧データの境界がこの周辺に存在すると判断する。
 次の例(6)は、新しいレコードのデータ部109内の1バイト(5バイト目)の位置と、旧レコードの前方データ長103の位置とが一致するが、書き込むデータバイトと旧レコードの前方データ長103との値が一致しないケースである。例(6)に示すように、記憶領域61のデータ結合フラグ115の直後に、データ部109の長さが2の新レコードeが書き込まれる。
However, the head / tail flag determination unit 29 has the value of the flag immediately before the value “4” of the backward data length 113 of the overwritten record b as “1”, and the comparison is made with the forward data length 103. However, since it is determined that the data length is the backward data length 113, it is determined that the boundary between the old and new data exists in this vicinity.
In the next example (6), the position of the 1st byte (5th byte) in the data portion 109 of the new record matches the position of the forward data length 103 of the old record. In this case, the data length 103 does not match the value. As shown in the example (6), immediately after the data combination flag 115 in the storage area 61, a new record e having a length of 2 in the data portion 109 is written.
 その際、レコードeのローテーションフラグ105には、ローテーションフラグ記憶部55に記憶されている値“1”が書き込まれ、重複位置情報107には、重複位置が存在しないため値“0”が書き込まれる。このため、第2ヘッダバイト125の値が“0x80”となる。
 その後、最古レコード特定部11は、左向きの矢印で示すように、記憶領域61の末尾からレコードを前方に辿っていく。データ長比較部25が、上書きされたレコードbの後方データ長113の値と、レコードeのデータ部のデータとが不一致の場合、レコードbが無効であり、ここに新旧データの境界が存在すると判断できる。
At this time, the value “1” stored in the rotation flag storage unit 55 is written to the rotation flag 105 of the record e, and the value “0” is written to the overlap position information 107 because there is no overlap position. . Therefore, the value of the second header byte 125 is “0x80”.
Thereafter, the oldest record specifying unit 11 traces the record forward from the end of the storage area 61 as indicated by a left-pointing arrow. When the data length comparison unit 25 does not match the value of the backward data length 113 of the overwritten record b with the data of the data portion of the record e, the record b is invalid, and there is a boundary between the old and new data here. I can judge.
 次の例(7)は、新しいレコードのデータ部109内の1バイト(5バイト目)の位置と、旧レコードの前方データ長103の位置とが一致し、かつ書き込むバイトと旧レコードの前方データ長103との値が一致するケースである。例(7)に示すように、記憶領域61のデータ結合フラグ115の直後に、データ部109の長さが2の新レコードeが書き込まれる。 In the next example (7), the position of the 1st byte (5th byte) in the data portion 109 of the new record matches the position of the forward data length 103 of the old record, and the byte to be written and the forward data of the old record This is a case where the value of the length 103 matches. As shown in the example (7), immediately after the data combination flag 115 in the storage area 61, a new record e having a length of 2 in the data portion 109 is written.
 その際、レコードeのローテーションフラグ105には、ローテーションフラグ記憶部55に記憶されている値“1”が書き込まれる。しかし、図3を参照して説明したように、書き込むデータと旧レコードの前方データ長103とが一致するため、当該バイトを反転させる。その結果、重複位置情報107には、反転させたバイトの位置“5”が書き込まれる。このため、第2ヘッダバイト125の値が“0x85”となる。 At that time, the value “1” stored in the rotation flag storage unit 55 is written in the rotation flag 105 of the record e. However, as described with reference to FIG. 3, since the data to be written matches the forward data length 103 of the old record, the byte is inverted. As a result, the inverted byte position “5” is written in the overlap position information 107. Therefore, the value of the second header byte 125 is “0x85”.
 その後、最古レコード特定部11は、左向きの矢印で示すように、記憶領域61の末尾からレコードを前方に辿っていく。データ長比較部25が、上書きされたレコードbの後方データ長113の値と、レコードeのデータ部のデータとが一致する。この場合、図中のデータ部109の5バイト目の値が“0x04”である場合、この値が、前回書き込み時の前方データ長103と同じ値となり、当該箇所がデータバイトか前方データ長103かが判断できなくなる。このため、該当箇所のデータをビット反転させて“0xFB”とし、更にその反転させたバイト位置を重複位置情報107に記録する。 Thereafter, the oldest record specifying unit 11 traces the record forward from the end of the storage area 61 as indicated by the left-pointing arrow. The data length comparison unit 25 matches the value of the backward data length 113 of the overwritten record b with the data of the data portion of the record e. In this case, when the value of the fifth byte of the data portion 109 in the figure is “0x04”, this value is the same value as the forward data length 103 at the time of previous writing, and the corresponding portion is the data byte or the forward data length 103. Cannot be determined. For this reason, the data of the corresponding part is bit-inverted to “0xFB”, and the inverted byte position is recorded in the overlapping position information 107.
 次の例(8)は、古いレコードの前方データ長103の位置と新しいレコードの重複位置情報107の位置とが重なっているケースである。例(8)に示すように、記憶領域61のデータ結合フラグ115の直後に後方データ長113の新レコードeが書き込まれ、続いてデータ部109の長さが3の新レコードfが書き込まれる。
 この例(8)では、古いデータのデータ長がレコードfの重複位置情報107により上書きされる。重複位置情報107が“0”であり、後方データ長113と一致せず、更に値“0”はデータ長として無効な値であるため、新旧データの境界がこの付近に存在すると判別できる。
The next example (8) is a case where the position of the forward data length 103 of the old record and the position of the duplicate position information 107 of the new record overlap. As shown in the example (8), a new record e having a backward data length 113 is written immediately after the data combination flag 115 in the storage area 61, and subsequently a new record f having a length of 3 in the data portion 109 is written.
In this example (8), the data length of the old data is overwritten with the duplication position information 107 of the record f. Since the overlapping position information 107 is “0”, does not match the backward data length 113, and the value “0” is an invalid value for the data length, it can be determined that the boundary between the old and new data exists in this vicinity.
 次に、図7を参照して、不揮発メモリ9の記憶領域61の末尾をまたいでデータを書き込む方法について説明する。
 図7も同様に、破線の矢印は不揮発メモリ9の記憶領域61への最初一巡目の書き込みを示し、実線の矢印は二巡目の書き込みを示す。また、左斜め下向きの斜線の部分は第1ヘッダバイト123を示す。横線の部分は、第2ヘッダバイト125を示す。更に、右斜め下向きの斜線部分は、フッタ部127を示す。また、図6ではデータバイトを16進数で表記している。
Next, a method of writing data across the end of the storage area 61 of the nonvolatile memory 9 will be described with reference to FIG.
Similarly in FIG. 7, the broken-line arrows indicate the first round of writing to the storage area 61 of the nonvolatile memory 9, and the solid-line arrows indicate the second round of writing. Also, the diagonally downward slanting portion on the left indicates the first header byte 123. The horizontal line portion indicates the second header byte 125. Further, the diagonally downward hatched portion on the right indicates a footer portion 127. In FIG. 6, data bytes are expressed in hexadecimal.
 図7の例(9)に示すように、記憶領域61の残りの領域よりも、書き込むデータの方が大きい場合、可変長レコード記録部3は、データを記憶領域61に均一かつまんべんなく書き込むために、データを分割して記録する。
 詳細には、書き込むデータのサイズ、ヘッダ部121及びフッタ部127の合計サイズが、記憶領域61の残りの容量を超える場合、データ結合フラグ設定部41が、書き込むデータを分割する。その際、記憶領域61の末尾に記録させるデータ部109のサイズは以下の式
 (記憶領域61の残り容量)-(ヘッダ部121のサイズ+フッタ部127のサイズ)
で求められる。このサイズでデータを分割し、データ部109とし、ヘッダ部121及びフッタ部127を付加してレコードを書き込む。
As shown in the example (9) of FIG. 7, when the data to be written is larger than the remaining area of the storage area 61, the variable length record recording unit 3 writes the data uniformly and evenly in the storage area 61. The data is divided and recorded.
Specifically, when the size of the data to be written and the total size of the header part 121 and the footer part 127 exceed the remaining capacity of the storage area 61, the data combination flag setting unit 41 divides the data to be written. At that time, the size of the data part 109 to be recorded at the end of the storage area 61 is expressed by the following formula (remaining capacity of the storage area 61) − (size of the header part 121 + size of the footer part 127).
Is required. Data is divided by this size to form a data part 109, and a header part 121 and a footer part 127 are added to write a record.
 そして、残りのデータを、記憶領域61の先頭から、同様に、ヘッダ部121及びフッタ部127を付加して記録する。
 その際、末尾のレコードと先頭のレコードとは、元は一つのデータであったことを示すために、記憶領域61の先頭のデータ結合フラグ115に、例えば値“1”を設定する。なお、データ結合フラグ115のサイズが1ビットである場合、データ結合フラグ設定部41は、バイト境界に合わせるために、記憶領域61の先頭バイトの残りの7ビットに、例えば“0”をパディングする。
The remaining data is similarly recorded from the top of the storage area 61 with the header part 121 and the footer part 127 added thereto.
At this time, for example, the value “1” is set in the head data combination flag 115 of the storage area 61 in order to indicate that the tail record and the head record are originally one data. When the size of the data combination flag 115 is 1 bit, the data combination flag setting unit 41 pads the remaining 7 bits of the first byte of the storage area 61 with, for example, “0” in order to match the byte boundary. .
 このように処理を行なうことで、読み出しの際に、データ結合フラグ設定部41を参照することで、2つに分割されたレコードを1つのデータとして復元することができる。
 本実施形態においては、最小のレコードサイズは、ヘッダ部121、データ部109、及びフッタ部127を合計したサイズ(例えば、図2の例では4バイト)となる。このため、記憶領域61の残り領域がこのサイズより小さい場合には、この残った領域を“0”で埋めておく。
By performing the processing in this way, the record divided into two can be restored as one data by referring to the data combination flag setting unit 41 at the time of reading.
In the present embodiment, the minimum record size is a total size of the header part 121, the data part 109, and the footer part 127 (for example, 4 bytes in the example of FIG. 2). Therefore, when the remaining area of the storage area 61 is smaller than this size, the remaining area is filled with “0”.
 データを記憶領域61の最後から読み出す際に、レコードの最後は必ず「後方データ長113」となるため、“0”のシーケンスとはならない。このため、記憶領域61の最後の“0”のシーケンスの領域をスキップすることで、末尾のレコードの後方データ長113を検出することができる。
 次に、上記のように不揮発メモリ9の記憶領域61に記録したデータを読み出す際の処理について説明する。
When data is read from the end of the storage area 61, the end of the record always has the “rear data length 113”, so that the sequence of “0” does not occur. Therefore, by skipping the last “0” sequence area in the storage area 61, the rear data length 113 of the last record can be detected.
Next, processing when reading the data recorded in the storage area 61 of the nonvolatile memory 9 as described above will be described.
 データの読み出し時には、図8のフローチャートのステップS1~S23を実行し、最も古いレコードの位置と最新レコードの位置を特定する。
 これらの処理は、図5のフローチャートのステップS1~S23と同じであるので、その説明は省略する。
 ステップS21に続いて、ステップS31において、読み出し部17は、最も古いレコードから順にレコードを読み出す。
At the time of reading data, steps S1 to S23 in the flowchart of FIG. 8 are executed to specify the position of the oldest record and the position of the latest record.
Since these processes are the same as steps S1 to S23 in the flowchart of FIG. 5, description thereof is omitted.
Subsequent to step S21, in step S31, the reading unit 17 reads records in order from the oldest record.
 ステップS33において、読み出し部17は、記憶領域61の末尾に達したかどうかを判定する。
 記憶領域61の末尾に達していない場合(ステップS33のNOルート参照)、ステップS35において、読み出し部17は、1つ前の(次に古い)レコードを読み出す。
 記憶領域61の末尾に達するまで、上記ステップS33,S35の処理を繰り返す。
In step S <b> 33, the reading unit 17 determines whether the end of the storage area 61 has been reached.
When the end of the storage area 61 has not been reached (refer to the NO route in step S33), in step S35, the reading unit 17 reads the previous (next oldest) record.
The processes in steps S33 and S35 are repeated until the end of the storage area 61 is reached.
 記憶領域61の末尾に達した場合(ステップS33のYESルート参照)場合、ステップS37において、読み出し部17は、記憶領域61の先頭のレコードを読み出す。
 ステップS39において、読み出し部17は、最新レコードに達したかどうかを判定する。
 最新レコードに達していない場合(ステップS39のNOルート参照)、ステップS41において、読み出し部17は、1つ前の(次に古い)レコードを読み出す。
When the end of the storage area 61 is reached (see YES route in step S33), the reading unit 17 reads the top record in the storage area 61 in step S37.
In step S39, the reading unit 17 determines whether or not the latest record has been reached.
If the latest record has not been reached (see NO route in step S39), in step S41, the reading unit 17 reads the previous (next oldest) record.
 最新レコードに達した場合(ステップS39のYESルート参照)、読み出し処理を終了する。
 このように、記憶領域61の末尾のレコードから前方にデータを読み出し、次に記憶領域61の先頭に移動して、先頭のレコードから最新レコードの順に後方にレコードを読み出すことにより、読み出し部17は、データが書き込まれた順にデータを読み出すことができる。
When the latest record is reached (see YES route in step S39), the reading process is terminated.
In this way, the reading unit 17 reads data forward from the last record in the storage area 61, then moves to the top of the storage area 61, and reads records backward from the top record in the order of the latest record. The data can be read in the order in which the data is written.
 図9は、第1実施形態の一例としてのシステム制御部1を搭載した機器1のハードウェア構成を示す模式図である。
 システム制御部1は、制御対象97に対して何らかの制御を行なう。例えば、システム制御部1がサーバ筐体内のシステムボードに搭載されるサービスプロセッサの場合には、制御対象97はサーバ本体などである。
FIG. 9 is a schematic diagram illustrating a hardware configuration of the device 1 including the system control unit 1 as an example of the first embodiment.
The system control unit 1 performs some control on the control target 97. For example, when the system control unit 1 is a service processor mounted on a system board in a server housing, the control target 97 is a server body.
 システム制御部1は、可変長レコード記録部3と、制御対象97を実際に制御するための制御プログラム93とを有する。
 システム制御部1は、システム制御部1の可変長レコード記録部3が、制御に係る動作ログや制御対象97の異常ログを不揮発メモリ9の記憶領域61に記憶する。その際、可変長レコード記録部3は、図2に示したレコード構造100を用いてログデータの書き込みを行なう。
The system control unit 1 includes a variable length record recording unit 3 and a control program 93 for actually controlling the control target 97.
In the system control unit 1, the variable length record recording unit 3 of the system control unit 1 stores an operation log related to control and an abnormality log of the control target 97 in the storage area 61 of the nonvolatile memory 9. At this time, the variable-length record recording unit 3 writes log data using the record structure 100 shown in FIG.
 本実施形態との比較のために、前方データ長情報のみを有する可変長レコードを、記憶領域にシーケンシャルに繰り返し記録する手法の一例を図12に示す。
 この手法では、可変長データの前に当該データの長さを示すヘッダ情報を付加することで、記憶領域へのデータの書き込み開始位置(以下、上書き位置とも呼ぶ)と、記憶領域に既に書き込まれているデータ読み出し開始位置とを管理する。図12の(1)では、データA、データB、データC、データDの順に、記憶領域の先頭から末尾に向かってデータが書き込まれる。更に、これらの可変長データA~Dの前に、データ部分の長さを示すヘッダ情報がそれぞれ付加される。
For comparison with the present embodiment, an example of a technique for repeatedly recording a variable-length record having only forward data length information sequentially in a storage area is shown in FIG.
In this method, by adding header information indicating the length of the data before the variable-length data, the data write start position (hereinafter also referred to as overwrite position) to the storage area and the storage area are already written. The data read start position is managed. In (1) of FIG. 12, data is written from the beginning to the end of the storage area in the order of data A, data B, data C, and data D. Further, header information indicating the length of the data portion is added in front of these variable length data A to D, respectively.
 その後、図12の(2)に示すように、データDの後にデータEが書き込まれる。記憶領域の末尾までデータEの一部を書き込んだのち、記憶領域の先頭に戻り、データEの残りが書き込まれる。
 この場合、記憶領域の先頭に記録されていたデータAがデータEによって上書きされるため、読み出し可能な最も古いデータはデータBとなる。このため、データの読み出し開始位置を、データBの先頭(すなわち、データBのヘッダ情報)と認識しなければならない。その後更に、図12の(3)に示すように、データEの後にデータFが書き込まれる。
Thereafter, as shown in (2) of FIG. 12, data E is written after data D. After a part of the data E is written to the end of the storage area, it returns to the top of the storage area and the rest of the data E is written.
In this case, since the data A recorded at the head of the storage area is overwritten by the data E, the oldest readable data becomes the data B. For this reason, the data read start position must be recognized as the head of data B (that is, header information of data B). Thereafter, data F is written after data E as shown in FIG.
 しかし、この手法では、データの先頭にしかヘッダ情報がない。このため、図12の(2),(3)に示すように、記憶領域の先頭に戻ってデータAのヘッダ部分が上書きされてしまうと、読み出し可能な最も古いレコードの位置がどこか分からなくなってしまう。
 このような事態を回避するために、データの書き込み開始位置と読み出し開始位置とを不揮発記憶領域内に設けることも考えられる。しかし、不揮発記憶領域内にデータの書き込み開始位置と読み出し開始位置とを設けると、これらを記憶している位置の書き込み頻度が高くなり、不揮発記憶領域の素子寿命が低下する。
However, this method has header information only at the beginning of the data. For this reason, as shown in (2) and (3) of FIG. 12, if the header portion of the data A is overwritten by returning to the beginning of the storage area, the position of the oldest record that can be read is unknown. End up.
In order to avoid such a situation, it is conceivable to provide a data write start position and a read start position in the nonvolatile storage area. However, if a data write start position and a read start position are provided in the nonvolatile storage area, the frequency of writing at the position where these data are stored increases, and the element life of the nonvolatile storage area decreases.
 これに対して、本実施形態においては、データ部109の前と後の両方にデータ長情報103,113を付加するので、不揮発メモリ9自体から、新しいデータの書き込み開始位置と、記憶領域に書き込まれているデータの読み出し開始位置とを特定することができる。データの書き込み開始位置と読み出し開始位置とを不揮発メモリ9に記憶させる必要がなく、不揮発メモリ9の書き込み頻度が特定の領域に偏よらずに、不揮発メモリ9の全領域にわたって可変長レコード100をまんべんなく記録させることができる。 On the other hand, in this embodiment, since the data length information 103 and 113 is added both before and after the data portion 109, the new data write start position and the storage area are written from the nonvolatile memory 9 itself. It is possible to specify the read start position of the read data. There is no need to store the data write start position and the read start position in the nonvolatile memory 9, and the variable length records 100 are evenly distributed over the entire area of the nonvolatile memory 9 without the writing frequency of the nonvolatile memory 9 being biased to a specific area. It can be recorded.
 また、書き込もうとしているデータ部109内の1ビットの位置が、旧レコードの前方データ長103の位置と一致する場合に、当該重複バイトをビット反転させ、ビット反転させた位置を重複位置情報107に記憶する。これにより、後からこの新データを読み出す際に、前方データ長103とデータ部109の当該バイトとの一致が原因で、新レコードが最新のデータではないと誤って判別されてしまうことが回避される。更に、ビット反転させたバイトの位置を重複位置情報107に記録することで、後からデータを読み出す際に、元の情報に復元することが可能となる。 When the position of 1 bit in the data portion 109 to be written matches the position of the forward data length 103 of the old record, the duplicate byte is bit-inverted, and the bit-inverted position is the duplicate position information 107. To remember. This avoids erroneously determining that the new record is not the latest data due to the coincidence of the forward data length 103 and the corresponding byte of the data portion 109 when this new data is read later. The Furthermore, by recording the bit position that has been bit-reversed in the overlapping position information 107, it is possible to restore the original information when data is read later.
 更に、先頭フラグ101、ローテーションフラグ105及び最後尾フラグ111を設けているので、前方データ長103や後方データ長113と、他の情報との混同を防ぐことができる。
 また、データ結合フラグ115を用いてデータを分割することにより、記憶領域61の末尾までデータを詰めることができるので、データを更に偏りなく記憶させることができる。
(2)第2実施形態
 上記第1実施形態においては、1レコードを書き込む都度、前方データ長103と後方データ長113とが不一致となる箇所を検索する処理が必要となる。
Furthermore, since the head flag 101, the rotation flag 105, and the tail flag 111 are provided, it is possible to prevent the forward data length 103 and the backward data length 113 from being confused with other information.
Also, by dividing the data using the data combination flag 115, the data can be packed to the end of the storage area 61, so that the data can be stored evenly.
(2) Second Embodiment In the first embodiment described above, every time one record is written, it is necessary to search for a location where the forward data length 103 and the backward data length 113 do not match.
 そこで、第2実施形態の一例では、処理の高速化を図るために、図10に示すように、次レコード書き込み位置71と前方データ長配置情報73,75を、RAM7などの揮発領域に記録することにより、新旧レコードの区切り位置の検索を省略する。
 以下、第2実施形態の一例に係るシステム制御部1′について説明する。
 図10は、本実施形態の一例としてのシステム制御部1′の構成を示す模式図である。
Therefore, in the example of the second embodiment, in order to increase the processing speed, the next record write position 71 and the forward data length arrangement information 73 and 75 are recorded in a volatile area such as the RAM 7 as shown in FIG. Thus, the search for the break position of the old and new records is omitted.
Hereinafter, a system control unit 1 ′ according to an example of the second embodiment will be described.
FIG. 10 is a schematic diagram illustrating a configuration of a system control unit 1 ′ as an example of the present embodiment.
 本実施形態のシステム制御部1′は、図1に記載したシステム制御部1の構成に加え、RAM7内に、次レコード書き込み位置71、前回ローテーション用の前方データ長配置情報73、及び今回ローテーション用の前方データ長配置情報75を有する。
 なお、本実施形態のシステム制御部1′の他の構成については、図1,図4に図示した第1実施形態のシステム制御部1と同様であるため、その説明並びに図示を省略する。
In addition to the configuration of the system control unit 1 described in FIG. 1, the system control unit 1 ′ of the present embodiment stores the next record write position 71, the previous data length arrangement information 73 for the previous rotation, and the current rotation information in the RAM 7. Forward data length arrangement information 75.
Since the other configuration of the system control unit 1 ′ of the present embodiment is the same as that of the system control unit 1 of the first embodiment illustrated in FIGS. 1 and 4, the description and illustration thereof are omitted.
 次レコード書き込み位置71は、記憶領域61にデータの書き込みを開始するアドレスである。
 前回ローテーション用の前方データ長配置情報73は、前回のローテーションで記憶領域61に書き込んだ全レコードの各前方データ長103のアドレス(オフセット位置)とその値とを記憶する領域である。
The next record writing position 71 is an address at which data writing to the storage area 61 is started.
The forward data length arrangement information 73 for the previous rotation is an area for storing the address (offset position) and the value of each forward data length 103 of all records written in the storage area 61 in the previous rotation.
 今回ローテーション用の前方データ長配置情報75は、今回のローテーションで記憶領域61に書き込む全レコードの各前方データ長103のアドレス(オフセット位置)とその値とを記憶する領域である。前方データ長配置情報75は、可変長レコード記録部3によって記憶領域61へのデータの書き込み時に作成される。可変長レコード記録部3は、記憶領域61の末尾までレコードを記録すると、今回ローテーション用の前方データ長配置情報75を、前回ローテーション用の前方データ長配置情報73に一括転送し、今回ローテーション用の前方データ長配置情報75をクリアする。 The forward data length arrangement information 75 for the current rotation is an area for storing the address (offset position) and the value of each forward data length 103 of all records written in the storage area 61 in the current rotation. The forward data length arrangement information 75 is created when the variable length record recording unit 3 writes data to the storage area 61. When the variable length record recording unit 3 records the record to the end of the storage area 61, the forward data length arrangement information 75 for the current rotation is collectively transferred to the forward data length arrangement information 73 for the previous rotation, and the current data for the current rotation is rotated. The front data length arrangement information 75 is cleared.
 図11は、第2実施形態の一例としての可変長レコード記録部におけるデータの書き込み時の処理を示すフローチャートである。
 次レコード書き込み位置71、前回ローテーション用の前方データ長配置情報73、及び今回ローテーション用の前方データ長配置情報75は、RAM7に記憶されているので、システム制御部1′の電源切断時に消去される。このため、システム制御部1′の電源投入後、ステップS51の初期化を行なう。この初期化では、図8のステップS1~S23の処理を実行して、不揮発メモリ9の記憶領域61からデータを読み出す。更に、図8のステップS21で判定を行なったレコードの次のレコード位置を、RAM7の次レコード書き込み位置71に記憶する。更に、記憶領域61に記憶されている全レコードの前方データ長103を順次、今回ローテーション用の前方データ長配置情報75に記憶する。
FIG. 11 is a flowchart illustrating processing at the time of data writing in the variable-length record recording unit as an example of the second embodiment.
Since the next record writing position 71, the forward data length arrangement information 73 for the previous rotation, and the forward data length arrangement information 75 for the current rotation are stored in the RAM 7, they are erased when the system controller 1 'is powered off. . For this reason, initialization of step S51 is performed after the system controller 1 'is powered on. In this initialization, the processing of steps S1 to S23 in FIG. 8 is executed to read data from the storage area 61 of the nonvolatile memory 9. Further, the next record position of the record determined in step S 21 in FIG. 8 is stored in the next record write position 71 of the RAM 7. Further, the forward data length 103 of all records stored in the storage area 61 is sequentially stored in the forward data length arrangement information 75 for the current rotation.
 初期化が終了したら、ステップS53において、書き込み部15が、RAM7の次レコード書き込み位置71から書き込み位置を読み出す。
 次に、ステップS55において、書き込み部15は、RAM7の今回ローテーション用前方データ長配置情報75の前方データ長103に、最新のレコードを書き込む範囲と重複するものが存在し、かつデータが一致するかどうかをアドレス(オフセット)に基づいて判定する。
When the initialization is completed, the writing unit 15 reads the writing position from the next record writing position 71 of the RAM 7 in step S53.
Next, in step S55, the writing unit 15 determines whether there is an overlap in the forward data length 103 of the current rotation forward data length arrangement information 75 in the RAM 7 that overlaps the range in which the latest record is written and the data matches. Whether or not is determined based on the address (offset).
 RAM7の今回ローテーション用前方データ長配置情報75の前方データ長103に、最新のレコードを書き込む範囲と重複するものが存在し、かつデータが一致する場合(ステップS55のYESルート参照)、ステップS57において、重複位置情報生成部43は、重なる位置のバイトをビット反転する。更に、重複位置情報生成部43は、ビット反転させたバイトの位置を重複位置情報107に設定する。 If the forward data length 103 of the current rotation forward data length arrangement information 75 in the RAM 7 overlaps with the range in which the latest record is written and the data matches (see YES route in step S55), in step S57 The overlapping position information generation unit 43 bit-inverts the byte at the overlapping position. Further, the overlapping position information generating unit 43 sets the position of the byte with the bit inverted in the overlapping position information 107.
 ステップS59において、レコードを書き込む。その際、書き込んだレコードの前方データ長103を、今回ローテーション用の前方データ長配置情報75の最後に記憶する。
 次に、ステップS61において、書き込み部15は、ローテーションが行なわれたか、すなわち、書き込みが記憶領域61の末尾まで行なわれたかを判定する。
 ローテーションが行なわれた場合(ステップS61のYESルート参照)、ステップS63において、書き込み部15は、今回ローテーション用の前方データ長配置情報75を前回ローテーション用の前方データ長配置情報73に一括転送する。その後、今回ローテーション用の前方データ長配置情報75をクリアする。
In step S59, a record is written. At this time, the forward data length 103 of the written record is stored at the end of the forward data length arrangement information 75 for the current rotation.
Next, in step S <b> 61, the writing unit 15 determines whether rotation has been performed, that is, whether writing has been performed to the end of the storage area 61.
When rotation is performed (see YES route in step S61), in step S63, the writing unit 15 transfers the forward data length arrangement information 75 for current rotation to the forward data length arrangement information 73 for previous rotation in a batch. Thereafter, the forward data length arrangement information 75 for rotation this time is cleared.
 一方、ローテーションが行なわれていない場合(ステップS61のNOルート参照)、処理がステップS65に移る。
 ステップS65において、書き込み部15は、書き込んだレコードの前方データ長103のアドレス(オフセット位置)とその値とを、今回ローテーション用の前方データ長配置情報75の末尾に追加する。
On the other hand, when the rotation is not performed (see NO route in step S61), the process proceeds to step S65.
In step S65, the writing unit 15 adds the address (offset position) and the value of the forward data length 103 of the written record to the end of the forward data length arrangement information 75 for current rotation.
 ステップS67において、書き込み部15は、次レコード書き込み位置71を更新する。
 このように、本実施形態においては、上記第1実施形態の効果に加えて、書き込み処理の高速化という更なる効果を奏する。
(3)その他
 なお、本発明は、上述した各実施形態及び変形例に記載した構成に限定されるものではなく、本発明の趣旨を逸脱しない範囲で種々変形することが可能である。
In step S67, the writing unit 15 updates the next record writing position 71.
Thus, in this embodiment, in addition to the effect of the first embodiment, there is a further effect of speeding up the writing process.
(3) Others Note that the present invention is not limited to the configurations described in the above-described embodiments and modifications, and various modifications can be made without departing from the spirit of the present invention.
 例えば、図2に示したデータ長は例に過ぎず、システム制御部1が制御する対象や制御プログラム93、不図示のOSのログフォーマットに応じてデータ長を適宜変更することができる。
 また、図4に示した各機能ブロック内の機能及び構成は一例に過ぎず、各ブロックの機能の組み合わせを適宜変更してもよい。
For example, the data length shown in FIG. 2 is merely an example, and the data length can be appropriately changed according to the object controlled by the system control unit 1, the control program 93, and the OS log format (not shown).
Moreover, the function and structure in each functional block shown in FIG. 4 are only examples, and the combination of the functions of each block may be changed as appropriate.
 また、上記の各実施形態の一例においては、処理フローのステップの実行順序を変更してもよい。
 更に、旧データの前方データ長103と書き込むデータとの位置の重複を1バイト単位で判定したが、重複を複数バイト単位で判定してもよい。
 なお、上記の各実施形態においては、システム制御部1又は1′のCPU5が、可変長レコード記録プログラムを実行することにより、図4の可変長レコード記録部3、最古レコード特定部11、最新レコード特定部13、書き込み部15、読み出し部17、レコード走査部21、データ長取得部23、データ長比較部25、ローテーションフラグ比較部27、先頭/最後尾フラグ判定部29、レコード走査部31、データ長取得部33、最新レコード位置特定部35、データ結合フラグ設定部41、重複位置情報生成部43、ローテーションフラグ設定部45、及びレコード転送部47として機能する。
In the example of each embodiment described above, the execution order of the steps of the processing flow may be changed.
Furthermore, although the duplication of the position between the forward data length 103 of the old data and the data to be written is determined in units of 1 byte, the duplication may be determined in units of multiple bytes.
In each of the above-described embodiments, the CPU 5 of the system control unit 1 or 1 ′ executes the variable-length record recording program, so that the variable-length record recording unit 3, the oldest record specifying unit 11, and the latest record shown in FIG. Record identification unit 13, writing unit 15, reading unit 17, record scanning unit 21, data length acquisition unit 23, data length comparison unit 25, rotation flag comparison unit 27, head / tail flag determination unit 29, record scanning unit 31, It functions as the data length acquisition unit 33, the latest record position specifying unit 35, the data combination flag setting unit 41, the overlapping position information generation unit 43, the rotation flag setting unit 45, and the record transfer unit 47.
 また、システム制御部1又は1′のRAM7が、上書き位置記憶部51、一時レコード記憶部53、ローテーションフラグ記憶部55、次レコード書き込み位置71、前回ローテーション用の前方データ長配置情報73、及び今回ローテーション用の前方データ長配置情報7として機能する。
 なお、これらの可変長レコード記録部3、最古レコード特定部11、最新レコード特定部13、書き込み部15、読み出し部17、レコード走査部21、データ長取得部23、データ長比較部25、ローテーションフラグ比較部27、先頭/最後尾フラグ判定部29、レコード走査部31、データ長取得部33、最新レコード位置特定部35、データ結合フラグ設定部41、重複位置情報生成部43、ローテーションフラグ設定部45、及びレコード転送部47としての機能を実現するための可変長レコード記録プログラム(可変長レコード記録プログラム)は、例えばフレキシブルディスク,CD(CD-ROM,CD-R,CD-RW等),DVD(DVD-ROM,DVD-RAM,DVD-R,DVD+R,DVD-RW,DVD+RW,HD DVD等),ブルーレイディスク,磁気ディスク,光ディスク,光磁気ディスク等の、コンピュータ読取可能な記録媒体に記録された形態で提供される。そして、コンピュータはその記録媒体からプログラムを読み取って内部記憶装置又は外部記憶装置に転送し格納して用いる。又、そのプログラムを、例えば磁気ディスク,光ディスク,光磁気ディスク等の記憶装置(記録媒体)に記録しておき、その記憶装置から通信経路を介してコンピュータに提供するようにしてもよい。
In addition, the RAM 7 of the system control unit 1 or 1 ′ includes the overwrite position storage unit 51, the temporary record storage unit 53, the rotation flag storage unit 55, the next record writing position 71, the previous data length arrangement information 73 for the previous rotation, and the current time It functions as forward data length arrangement information 7 for rotation.
Note that these variable length record recording unit 3, oldest record specifying unit 11, latest record specifying unit 13, writing unit 15, reading unit 17, record scanning unit 21, data length obtaining unit 23, data length comparing unit 25, rotation Flag comparison unit 27, head / tail flag determination unit 29, record scanning unit 31, data length acquisition unit 33, latest record position specifying unit 35, data combination flag setting unit 41, duplicate position information generation unit 43, rotation flag setting unit 45 and a variable-length record recording program (variable-length record recording program) for realizing the function as the record transfer unit 47 are, for example, a flexible disk, CD (CD-ROM, CD-R, CD-RW, etc.), DVD (DVD-ROM, DVD-RAM, DVD-R, DVD + R, DVD-RW, DVD + W, HD DVD, etc.), a Blu-ray disc, a magnetic disk, an optical disk, such as a magneto-optical disk, is provided in a format recorded on a computer-readable recording medium. Then, the computer reads the program from the recording medium, transfers it to the internal storage device or the external storage device, stores it, and uses it. The program may be recorded in a storage device (recording medium) such as a magnetic disk, an optical disk, or a magneto-optical disk, and provided from the storage device to the computer via a communication path.
 可変長レコード記録部3、最古レコード特定部11、最新レコード特定部13、書き込み部15、読み出し部17、レコード走査部21、データ長取得部23、データ長比較部25、ローテーションフラグ比較部27、先頭/最後尾フラグ判定部29、レコード走査部31、データ長取得部33、最新レコード位置特定部35、データ結合フラグ設定部41、重複位置情報生成部43、ローテーションフラグ設定部45、及びレコード転送部47としての機能を実現する際には、内部記憶装置(本実施形態ではシステム制御部1又は1′のRAM7)に格納されたプログラムがコンピュータのマイクロプロセッサ(本実施形態ではシステム制御部1又は1′のCPU5)によって実行される。このとき、記録媒体に記録されたプログラムをコンピュータが読み取って実行するようにしてもよい。 Variable length record recording unit 3, oldest record specifying unit 11, latest record specifying unit 13, writing unit 15, reading unit 17, record scanning unit 21, data length acquiring unit 23, data length comparing unit 25, rotation flag comparing unit 27 , Head / tail flag determination unit 29, record scanning unit 31, data length acquisition unit 33, latest record position specifying unit 35, data combination flag setting unit 41, overlapping position information generation unit 43, rotation flag setting unit 45, and record When realizing the function as the transfer unit 47, the program stored in the internal storage device (in the present embodiment, the system control unit 1 or the RAM 7 of 1 ') is stored in a computer microprocessor (in the present embodiment, the system control unit 1). Alternatively, it is executed by the 1 'CPU 5). At this time, the computer may read and execute the program recorded on the recording medium.
 なお、本実施形態において、コンピュータとは、ハードウェアとオペレーティングシステムとを含む概念であり、オペレーティングシステムの制御の下で動作するハードウェアを意味している。又、オペレーティングシステムが不要でアプリケーションプログラム単独でハードウェアを動作させるような場合には、そのハードウェア自体がコンピュータに相当する。ハードウェアは、少なくとも、CPU等のマイクロプロセッサと、記録媒体に記録されたコンピュータプログラムを読み取るための手段とを備えており、本実施形態においては、システム制御部1又は1′がコンピュータとしての機能を有している。 In the present embodiment, the computer is a concept including hardware and an operating system, and means hardware that operates under the control of the operating system. Further, when an operating system is unnecessary and hardware is operated by an application program alone, the hardware itself corresponds to a computer. The hardware includes at least a microprocessor such as a CPU and means for reading a computer program recorded on a recording medium. In the present embodiment, the system control unit 1 or 1 'functions as a computer. have.
 本技術は、可変長ログの記録、データのバックアップなど、可変長レコードの記録に利用可能である。 This technology can be used to record variable length records such as variable length log recording and data backup.
 1,1′ システム制御部(記録装置)
 100  レコード構造(データセット、データ)
 101  先頭フラグ(データセットの先頭を表わす情報)
 103  前方データ長(前方データ長情報)
 105  ローテーションフラグ(書き込みのローテーションを示す情報)
 107  重複位置情報(ビット反転させた位置の情報)
 109  データ部
 11   最古レコード特定部
 13   最新レコード特定部
 15   書き込み部
 111  最後尾フラグ(データセットの最後尾を表わす情報)
 113  後方データ長(後方データ長情報)
 115  データ結合フラグ
 123  第1ヘッダバイト
 125  第2ヘッダバイト
 127  フッタ部
 3    可変長レコード記録部
 5    CPU(処理装置)
 7    RAM(別の記憶装置)
 71   次のレコードを書き込む位置
 75   データ長配置情報
 9    不揮発メモリ(記憶装置)
 97   制御対象
1,1 'system controller (recording device)
100 record structure (data set, data)
101 head flag (information indicating the head of the data set)
103 Forward data length (forward data length information)
105 rotation flag (information indicating write rotation)
107 Duplicate position information (information of bit-inverted position)
109 Data part 11 Oldest record specifying part 13 Latest record specifying part 15 Writing part 111 End flag (information indicating the end of the data set)
113 Back data length (back data length information)
115 Data Combined Flag 123 First Header Byte 125 Second Header Byte 127 Footer 3 Variable Length Record Recording 5 CPU (Processor)
7 RAM (another storage device)
71 Position for writing next record 75 Data length arrangement information 9 Non-volatile memory (storage device)
97 Control target

Claims (13)

  1.  記録装置にデータを記録する記録方法において、
     処理装置は、
     前記記録装置の記憶領域のうちの第1の記録位置から第2の記録位置に向けて、可変長データと、それぞれ該可変長データのデータ長を示し、該可変長データの前方及び後方に記録される前方及び後方データ長情報を含むデータセットを順次記録し、残り記録領域の不足発生に応じて前記第1の記録位置に戻って、前記第1の記録位置から前記第2の記録位置に向けて、記録済のデータを新たなデータセットで上書きした状態において、前記第2の記録位置から前記第1の記録位置に向けて後方データ長情報から求まる前方データ長情報の記録位置に対応する前方データ長情報が存在するデータセットが連続的に発見される第1の記録領域を特定し、
     前記第1の記録位置から前記第2の記録位置に向けて、前方データ長情報から求まる後方データ長情報の記録位置に対応する後方データ長情報が存在するデータセットであって、前記第1の記録領域に差し掛からず、前記第1の記録領域に最も近い位置に記録されたデータセットに後続させて、次のデータセットの記録開始位置として利用する、
     処理を実行することを特徴とする記録方法。
    In a recording method for recording data in a recording device,
    The processing equipment
    The variable length data and the data length of the variable length data are respectively indicated from the first recording position to the second recording position in the storage area of the recording device, and are recorded in front and rear of the variable length data. Sequentially recorded data sets including forward and backward data length information, return to the first recording position in response to the occurrence of a shortage of the remaining recording area, and move from the first recording position to the second recording position. Therefore, in a state where the recorded data is overwritten with a new data set, it corresponds to the recording position of the forward data length information obtained from the backward data length information from the second recording position toward the first recording position. Identifying a first recording area in which data sets with forward data length information are continuously found,
    A data set in which backward data length information corresponding to a recording position of backward data length information obtained from forward data length information exists from the first recording position to the second recording position, Use it as the recording start position of the next data set, following the data set recorded at the position closest to the first recording area without reaching the recording area.
    A recording method characterized by executing processing.
  2.  次のデータセットの記録時に、該データセットの一部の位置と記録済のデータの前方データ長情報の位置とが一致し、かつ該データセットの一部の値と前記記録済のデータの前方データ長情報とが一致する場合に、前記次のデータセットの前記一部の値をビット反転させると共に、前記ビット反転させた位置の情報を前記次のデータセット内に記憶することを特徴とする請求項1記載の記録方法。 At the time of recording the next data set, the position of a part of the data set matches the position of the forward data length information of the recorded data, and the value of the part of the data set and the front of the recorded data When the data length information matches, the partial value of the next data set is bit-inverted, and the information of the position where the bit is inverted is stored in the next data set. The recording method according to claim 1.
  3.  前記次のデータセットの記録時に、前記記憶装置の前記次のデータセットの記録開始位置から前記記憶装置の第2の記録位置までの領域が、前記次のデータセットを記録するのに不足する場合、前記次のデータセットの一部を前記記憶装置の前記第2の記録位置まで記録すると共に、前記次のデータセットが分割されていることを示す情報を前記記憶装置の第1の記録位置に記録し、続いて前記次のデータセットの残りを記録することを特徴とする請求項1又は2記載の記録方法。 When recording the next data set, the area from the recording start position of the next data set of the storage device to the second recording position of the storage device is insufficient to record the next data set. A part of the next data set is recorded up to the second recording position of the storage device, and information indicating that the next data set is divided is stored in the first recording position of the storage device. 3. The recording method according to claim 1, wherein recording is performed, and subsequently the rest of the next data set is recorded.
  4.  前記データセットは前記データセットの先頭を表わす情報と前記データセットの最後尾を表わす情報とを更に含み、
     前記第1の記録領域の特定時に、前記前方データ長情報と前記後方データ長情報との比較の結果両者が不一致となり、かつ前記先頭を表わす情報と前記最後尾を表わす情報とが不一致となる箇所を前記第1の記録領域として特定する請求項2記載の記録方法。
    The data set further includes information representing a head of the data set and information representing a tail of the data set;
    A location where both the front data length information and the rear data length information do not match when the first recording area is specified, and the information indicating the head and the information indicating the tail end do not match The recording method according to claim 2, wherein the first recording area is specified.
  5.  前記データセットは、前記記憶装置への書き込みのローテーションを示す情報を更に含み、
     前記第1の記録領域の特定時に、前記前方データ長情報と前記後方データ長情報との比較の結果両者が不一致となり、かつ前記ローテーションを示す情報と、1つ後方のデータセットのローテーションを示す情報とが不一致となる箇所を前記第1の記録領域として特定することを特徴とする請求項2記載の記録方法。
    The data set further includes information indicating a rotation of writing to the storage device,
    When the first recording area is specified, the comparison between the forward data length information and the backward data length information results in a mismatch, and information indicating the rotation and information indicating the rotation of the next data set The recording method according to claim 2, wherein a portion where the two are inconsistent with each other is specified as the first recording area.
  6. 前記次のデータセットの記録時に、別の記憶装置に、前記書き込むデータセットの前方データ長情報及び前記記憶装置の前記第1の記録位置からのオフセットと、次のデータセットを書き込む位置とを記憶することを特徴とする請求項1記載の記録方法。 When the next data set is recorded, the forward data length information of the data set to be written, the offset from the first recording position of the storage device, and the position to write the next data set are stored in another storage device. The recording method according to claim 1, wherein:
  7.  記憶領域を有する記録装置であって、
     前記記録装置の記憶領域のうちの第1の記録位置から第2の記録位置に向けて、可変長データと、それぞれ該可変長データのデータ長を示し、該可変長データの前方及び後方に記録される前方及び後方データ長情報を含むデータセットを順次記録し、残り記録領域の不足発生に応じて前記第1の記録位置に戻って、前記第1の記録位置から前記第2の記録位置に向けて、記録済のデータを新たなデータセットで上書きした状態において、前記第2の記録位置から前記第1の記録位置に向けて後方データ長情報から求まる前方データ長情報の記録位置に対応する前方データ長情報が存在するデータセットが連続的に発見される第1の記録領域を特定し、
     前記第1の記録位置から前記第2の記録位置に向けて、前方データ長情報から求まる後方データ長情報の記録位置に対応する後方データ長情報が存在するデータセットであって、前記第1の記録領域に差し掛からず、前記第1の記録領域に最も近い位置に記録されたデータセットに後続させて、次のデータセットの記録開始位置として利用することを特徴とする記録装置。
    A recording device having a storage area,
    The variable length data and the data length of the variable length data are respectively indicated from the first recording position to the second recording position in the storage area of the recording device, and are recorded in front and rear of the variable length data. Sequentially recorded data sets including forward and backward data length information, return to the first recording position in response to the occurrence of a shortage of the remaining recording area, and move from the first recording position to the second recording position. Therefore, in a state where the recorded data is overwritten with a new data set, it corresponds to the recording position of the forward data length information obtained from the backward data length information from the second recording position toward the first recording position. Identifying a first recording area in which data sets with forward data length information are continuously found,
    A data set in which backward data length information corresponding to a recording position of backward data length information obtained from forward data length information exists from the first recording position to the second recording position, A recording apparatus characterized by being used as a recording start position of the next data set following the data set recorded at a position closest to the first recording area without reaching the recording area.
  8.  次のデータセットの記録時に、該データセットの一部の位置と記録済のデータの前方データ長情報の位置とが一致し、かつ該データセットの一部の値と前記記録済のデータの前方データ長情報とが一致する場合に、前記次のデータセットの前記一部の値をビット反転させると共に、前記ビット反転させた位置の情報を前記次のデータセット内に記憶することを特徴とする請求項7記載の記録装置。 At the time of recording the next data set, the position of a part of the data set matches the position of the forward data length information of the recorded data, and the value of the part of the data set and the front of the recorded data When the data length information matches, the partial value of the next data set is bit-inverted, and the information of the position where the bit is inverted is stored in the next data set. The recording apparatus according to claim 7.
  9.  前記次のデータセットの記録時に、前記記憶装置の前記次のデータセットの記録開始位置から前記記憶装置の第2の記録位置までの領域が、前記次のデータセットを記録するのに不足する場合、前記次のデータセットの一部を前記記憶装置の前記第2の記録位置まで記録すると共に、前記次のデータセットが分割されていることを示す情報を前記記憶装置の第1の記録位置に記録し、続いて前記次のデータセットの残りを記録することを特徴とする請求項7又は8記載の記録装置。 When recording the next data set, the area from the recording start position of the next data set of the storage device to the second recording position of the storage device is insufficient to record the next data set. A part of the next data set is recorded up to the second recording position of the storage device, and information indicating that the next data set is divided is stored in the first recording position of the storage device. 9. The recording apparatus according to claim 7, wherein recording is performed, and then the rest of the next data set is recorded.
  10.  前記データセットは前記データセットの先頭を表わす情報と前記データセットの最後尾を表わす情報とを更に含み、
     前記第1の記録領域の特定時に、前記前方データ長情報と前記後方データ長情報との比較の結果両者が不一致となり、かつ前記先頭を表わす情報と前記最後尾を表わす情報とが不一致となる箇所を前記第1の記録領域として特定する請求項8記載の記録装置。
    The data set further includes information representing a head of the data set and information representing a tail of the data set;
    A location where both the front data length information and the rear data length information do not match when the first recording area is specified, and the information indicating the head and the information indicating the tail end do not match The recording apparatus according to claim 8, wherein the first recording area is specified.
  11.  前記データセットは、前記記憶装置への書き込みのローテーションを示す情報を更に含み、
     前記第1の記録領域の特定時に、前記前方データ長情報と前記後方データ長情報との比較の結果両者が不一致となり、かつ前記ローテーションを示す情報と、1つ後方のデータセットのローテーションを示す情報とが不一致となる箇所を前記第1の記録領域として特定することを特徴とする請求項8記載の記録装置。
    The data set further includes information indicating a rotation of writing to the storage device,
    When the first recording area is specified, the comparison between the forward data length information and the backward data length information results in a mismatch, and information indicating the rotation and information indicating the rotation of the next data set The recording apparatus according to claim 8, wherein a portion where the two are inconsistent with each other is specified as the first recording area.
  12. 前記次のデータセットの記録時に、別の記憶装置に、前記書き込むデータセットの前方データ長情報及び前記記憶装置の前記第1の記録位置からのオフセットと、次のデータセットを書き込む位置とを記憶することを特徴とする請求項7記載の記録装置。 When the next data set is recorded, the forward data length information of the data set to be written, the offset from the first recording position of the storage device, and the position to write the next data set are stored in another storage device. The recording apparatus according to claim 7.
  13.  コンピュータに、記録装置にデータを記録させる記録プログラムであって、
     前記コンピュータに、
     前記記録装置の記憶領域のうちの第1の記録位置から第2の記録位置に向けて、可変長データと、それぞれ該可変長データのデータ長を示し、該可変長データの前方及び後方に記録される前方及び後方データ長情報を含むデータセットを順次記録し、残り記録領域の不足発生に応じて前記第1の記録位置に戻って、前記第1の記録位置から前記第2の記録位置に向けて、記録済のデータを新たなデータセットで上書きした状態において、前記第2の記録位置から前記第1の記録位置に向けて後方データ長情報から求まる前方データ長情報の記録位置に対応する前方データ長情報が存在するデータセットが連続的に発見される第1の記録領域を特定し、
     前記第1の記録位置から前記第2の記録位置に向けて、前方データ長情報から求まる後方データ長情報の記録位置に対応する後方データ長情報が存在するデータセットであって、前記第1の記録領域に差し掛からず、前記第1の記録領域に最も近い位置に記録されたデータセットに後続させて、次のデータセットの記録開始位置として利用する、
     処理を実行させることを特徴とする記録プログラム。
    A recording program for causing a computer to record data in a recording device,
    In the computer,
    The variable length data and the data length of the variable length data are respectively indicated from the first recording position to the second recording position in the storage area of the recording device, and are recorded in front and rear of the variable length data. Sequentially recorded data sets including forward and backward data length information, return to the first recording position in response to the occurrence of a shortage of the remaining recording area, and move from the first recording position to the second recording position. Therefore, in a state where the recorded data is overwritten with a new data set, it corresponds to the recording position of the forward data length information obtained from the backward data length information from the second recording position toward the first recording position. Identifying a first recording area in which data sets with forward data length information are continuously found,
    A data set in which backward data length information corresponding to a recording position of backward data length information obtained from forward data length information exists from the first recording position to the second recording position, Use it as the recording start position of the next data set, following the data set recorded at the position closest to the first recording area without reaching the recording area.
    A recording program for executing a process.
PCT/JP2012/057062 2012-03-19 2012-03-19 Recording method, recording device, and recording program WO2013140516A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/JP2012/057062 WO2013140516A1 (en) 2012-03-19 2012-03-19 Recording method, recording device, and recording program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2012/057062 WO2013140516A1 (en) 2012-03-19 2012-03-19 Recording method, recording device, and recording program

Publications (1)

Publication Number Publication Date
WO2013140516A1 true WO2013140516A1 (en) 2013-09-26

Family

ID=49222010

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2012/057062 WO2013140516A1 (en) 2012-03-19 2012-03-19 Recording method, recording device, and recording program

Country Status (1)

Country Link
WO (1) WO2013140516A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS639587A (en) * 1986-06-30 1988-01-16 凸版印刷株式会社 Ic card
JP2001229068A (en) * 2000-02-16 2001-08-24 Dainippon Printing Co Ltd Ic module
JP2002229847A (en) * 2001-02-06 2002-08-16 Seiko Epson Corp Data management device of flash memory
JP2007133487A (en) * 2005-11-08 2007-05-31 Nec Corp File management method, device, and program

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS639587A (en) * 1986-06-30 1988-01-16 凸版印刷株式会社 Ic card
JP2001229068A (en) * 2000-02-16 2001-08-24 Dainippon Printing Co Ltd Ic module
JP2002229847A (en) * 2001-02-06 2002-08-16 Seiko Epson Corp Data management device of flash memory
JP2007133487A (en) * 2005-11-08 2007-05-31 Nec Corp File management method, device, and program

Similar Documents

Publication Publication Date Title
US8285965B2 (en) Aligning data storage device partition to boundary of physical data sector
JP4164118B1 (en) Storage device using flash memory
US8935469B2 (en) Autonomic reclamation processing for tapes
JP4215746B2 (en) Information processing apparatus and life monitoring method
JP2010020586A (en) Data processing device
JP2008117516A (en) Method of providing block state information in semiconductor memory device including flash memory
KR20070046844A (en) Method and apparatus for using a one-time or few-time programmable memory with a host device designed for erasable/rewriteable memory
JP2014044490A (en) Host device and memory device
JP2015036851A (en) Method for performing spanning of one file in multiple tape media, storage system, and program
KR20070089603A (en) Apparatus, method, and computer program for processing information
JP2008504628A (en) Safe flushing
JP2013161185A (en) Magnetic tape device and control method of the same
CN114840449A (en) Data storage method, device, equipment and storage medium based on MCU chip flash
TWI519951B (en) Data storage device and flash memory control method
KR20080066381A (en) Method for upgrading software
WO2013140516A1 (en) Recording method, recording device, and recording program
JP2015133164A (en) Tape device, write processing method, and write control program
JP2004362580A (en) Storage system, its operation method, and tape storage medium device
JPWO2013140516A1 (en) Recording method, recording apparatus, and recording program
US9405668B1 (en) Data storage device initialization information accessed by searching for pointer information
JP2005243120A (en) Information recording device, its control method, information recording program, and recording medium
US20140089356A1 (en) Data storage device and operating method thereof
US8996839B1 (en) Data storage device aligning partition to boundary of sector when partition offset correlates with offset of write commands
JP5533141B2 (en) Writing device, writing method, and writing program
KR101083054B1 (en) Flash memory overwriting method and apparatus

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12872179

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2014505847

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12872179

Country of ref document: EP

Kind code of ref document: A1