[go: up one dir, main page]

CN105159778B - Improve the method for the I/O read or write speed of IPkg program under Optware environment - Google Patents

Improve the method for the I/O read or write speed of IPkg program under Optware environment Download PDF

Info

Publication number
CN105159778B
CN105159778B CN201510483518.XA CN201510483518A CN105159778B CN 105159778 B CN105159778 B CN 105159778B CN 201510483518 A CN201510483518 A CN 201510483518A CN 105159778 B CN105159778 B CN 105159778B
Authority
CN
China
Prior art keywords
nvram
read
value
optware
environment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510483518.XA
Other languages
Chinese (zh)
Other versions
CN105159778A (en
Inventor
陶成军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huzhou Yinglie Intellectual Property Operation Co ltd
Original Assignee
Shanghai Feixun Data Communication Technology Co Ltd
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 Shanghai Feixun Data Communication Technology Co Ltd filed Critical Shanghai Feixun Data Communication Technology Co Ltd
Priority to CN201510483518.XA priority Critical patent/CN105159778B/en
Publication of CN105159778A publication Critical patent/CN105159778A/en
Application granted granted Critical
Publication of CN105159778B publication Critical patent/CN105159778B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Storage Device Security (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The present invention provides a kind of method for improving the I/O read or write speed of IPKG program under Optware environment, comprising steps of opening NVRAM character device;The NVRAM character device calls mmap mechanism by kernel character string address of cache into memory address space in application layer;The NVRAM character device carries out read or write.When low consumption can be achieved in the present invention, reduces I/O opening and closing, promotes efficient read or write speed, easy-to-use character device reading technology;Based on NVRAM character device operating technology, the I/O operation using script and traditional file read-write, the technical disadvantages that while circulation plus sleep wait script execution to complete, development prospect with higher are overcome.

Description

Improve the method for the I/O read or write speed of IPkg program under Optware environment
Technical field
The present invention relates to I/O apparatus field more particularly to a kind of I/O read-writes for improving IPkg program under Optware environment The method of speed.
Background technique
Optware is a similar third-party running environment in DD-WRT system, can be with the ring of router itself Border coexists, which is present on the router for supporting USB device, and using the form of IPKG installation kit, adds additional function Can, it can reduce weight to router firmware, firmware only saves basic u-boot and some basic routing functions, will be a large amount of Third equation installed in the form of pkg in the router, one will certainly be led to the problem of in this way, how to read route system In NVRAM value.
Existing technology is to need to read in a program a certain by adding a shell script in Optware environment When a NVRAM (Non-Volatile Random Access Memory, nonvolatile random access memory) value, call The NVRAM value of NVRAM is passed to script by shell script, by calling the order of nvram_get to write into a text in script In part, this temporary file then is being opened in a program, content is read out, will certainly generate a large amount of I/O's in this way It closes and opens.
The existing mode for reading NVRAM of Optware at present needs to expend the movement that a large amount of I/O are opened and closed, also needs It adds while circular test shell script and whether has write complete, such program expends a large amount of waiting time, unfavorable In the use of some Pkg files of poll.
The installation of ipkg is all based on the routing device of self-carried USB, by installing third-party Optware environment, provides Support to ipkg running environment.
General IPkg program needs to read the value of write-in NVRAM, needs first to call script, what transmitting needed to read Value, is write into interim file by the NVRAM value of NVRAM, by way of reading file value, is obtained in a program corresponding Value.
If using this situation program once request in read seldom NVRAM, do not have apparent influence, if It is that this web server of lighttpd uses, needs to read a large amount of NVRAM value in primary request, this will lead to GUI's It responds very slow.I/O reading efficiency can be greatly promoted by reading NVRAM character device, improve response speed.
Summary of the invention
In view of the above problems, the application describes a kind of I/O read or write speed of IPkg program under improvement Optware environment Method, comprising steps of
Open NVRAM character device;
The NVRAM character device calls mmap mechanism by kernel character string address of cache to memory address sky in application layer Between in;
The NVRAM character device carries out read or write.
Preferably, step carry out read operation comprising steps of
Pkg file reads a NVRAM value;
The NVRAM value is read from global variable corresponds to offset;
Read the value that the offset is accessed.
Preferably, step carry out write operation comprising steps of
Pkg file reads a NVRAM value;
The NVRAM value is read from global variable corresponds to offset;
Data are written in the offset.
Preferably, the corresponding offset bit of the NVRAM value is in global variable.
Preferably, judging whether the global variable has already turned on after the Pkg file reads the NVRAM value;
If the global variable has been opened, it is corresponding that execution step reads the NVRAM value from the global variable The offset;
Otherwise, the Pkg file, which calls, opens the function opening global variable, and the global variable executes step after opening Suddenly the corresponding offset of the NVRAM value is read from the global variable.
Preferably, the kernel character string address of cache is between the heap area and stack area of memory address space.
Above-mentioned technical proposal have the following advantages that or the utility model has the advantages that the present invention can be achieved low consumption when, reduce I/O beat on and off It closes, promote efficient read or write speed, easy-to-use character device reading technology;Based on NVRAM character device operating technology, gram The I/O operation read and write using script and traditional file is taken, the technology that while circulation plus sleep wait script execution to complete lacks Point, development prospect with higher.
Detailed description of the invention
With reference to appended attached drawing, more fully to describe the embodiment of the present invention.However, appended attached drawing be merely to illustrate and It illustrates, and is not meant to limit the scope of the invention.
Fig. 1 is a kind of method kernel character string for improving the I/O read or write speed of IPkg program under Optware environment of the present invention Status diagram of the address of cache to memory address space;
Fig. 2 is that a kind of improve of the present invention carries out reading behaviour in the method for the I/O read or write speed of IPkg program under Optware environment The flow chart of work;
Fig. 3 is that a kind of method for improving the I/O read or write speed of IPkg program under Optware environment of the present invention carries out write operation Flow chart.
Specific embodiment
The I/O for improving IPkg program under Optware environment of the invention is read and write in the following with reference to the drawings and specific embodiments The method of speed is described in detail.
A method of improving the I/O read or write speed of IPkg program under Optware environment, comprising steps of
Open NVRAM character device;
Call the mechanism of mmap by kernel character string address of cache into memory address space in application layer;
NVRAM character device carries out read operation.
As shown in Figure 1, wherein call mmap by the content map of file into memory address space, the file is deposited Demapping section is stored up between heap area and stack area.
As shown in Fig. 2, specifically including step during NVRAM character device carries out read operation:
Pkg file reads some NVRAM value;
The nvram_get for calling encapsulation, that is, call a detection function;
Judge whether global variable nvram_fd has already turned on using the detection function;
If global variable nvram_fd is opened, read function is called, the corresponding offset of NVRAM value is read out offset;
If global variable nvram_fd is not turned on, the nvram_init of encapsulation is called, that is, calls and opens function, is utilized The opening function opens the global variable, calls read function later, reads out the corresponding offset of NVRAM value offset;
The value value that corresponding offset is accessed is read from global variable nvram_buf.
In this process, it first determines whether global variable nvram_fd has already turned on, calls read letter if opening Number, reads out the corresponding offset offset of NVRAM value, and corresponding offset institute is finally read from global variable nvram_buf Primary reading can be completed in the value of access.
As shown in figure 3, specifically including step during NVRAM character device carries out write operation:
Pkg file reads some NVRAM value;
The nvram_get for calling encapsulation, that is, call a detection function;
Judge whether global variable nvram_fd has already turned on using the detection function;
If global variable nvram_fd is opened, read function is called, the corresponding offset of NVRAM value is read out offset;
If global variable nvram_fd is not turned on, the nvram_init of encapsulation is called, that is, calls and opens function, is utilized The opening function opens the global variable, calls read function later, reads out the corresponding offset of NVRAM value offset;
The write-in value value in offset offset.
The present invention mainly adds opening, reading and writing and the closing of NVRAM character device in the Pkg file of Optware environment Operation.The primary filec descriptor for opening character device is realized in the movement of opening, and maps kernel character string to user's space, The operation of reading is consistent with normal file read operation, is called by the read of system to the read handling function of NVRAM character device, It realizes the offset address for reading the NVRAM value of corresponding NVRAM, searches correspondence from corresponding be mapped in the character string of user's space The value of offset returns to caller, completes the movement once read, and the mode write is similar.
The present invention is applied in the corresponding Pkg file of Optware environment using the operation of NVRAM character device, realizes one It is secondary to open the efficient read-write mode once closed, make the Pkg file of Optware environment that can also normally read NVRAM value.
When low consumption can be achieved in the present invention, reduces I/O opening and closing, promotes efficient read or write speed, easy-to-use word It accords with equipment and reads technology;Based on NVRAM character device operating technology, the I/O behaviour using script and traditional file read-write is overcome Make, the technical disadvantages that while circulation plus sleep waiting script execution are completed, development prospect with higher.
For a person skilled in the art, after reading above description, various changes and modifications undoubtedly be will be evident. Therefore, appended claims should regard the whole variations and modifications for covering true intention and range of the invention as.It is weighing The range and content of any and all equivalences, are all considered as still belonging to the intent and scope of the invention within the scope of sharp claim.

Claims (4)

1. a kind of method for improving the I/O read or write speed of IPkg program under Optware environment, which is characterized in that comprising steps of
Opening, reading and writing and the operation of closing of NVRAM character device are added in the Pkg file of Optware environment;
Open NVRAM character device;
The NVRAM character device calls mmap mechanism by kernel character string address of cache to memory address space in application layer In;
The NVRAM character device carries out read or write;
The step of progress read operation includes:
Pkg file reads a NVRAM value;
It reads the NVRAM value and corresponds to offset;
Read the value that the offset is accessed;
The step of progress write operation includes:
Pkg file reads a NVRAM value:
It reads the NVRAM value and corresponds to offset;
Data are written in the offset.
2. the method according to claim 1 for improving the I/O read or write speed of IPkg program under Optware environment, feature It is, in the method:
The corresponding offset bit of the NVRAM value is in global variable.
3. the method according to claim 2 for improving the I/O read or write speed of IPkg program under Optware environment, feature It is, in the method:
After the Pkg file reads the NVRAM value, judge whether the global variable has already turned on;
If the global variable has been opened, it is corresponding described that execution step reads the NVRAM value from the global variable Offset;
Otherwise, the Pkg file, which calls, opens function and opens the global variable, the global variable executed after opening step from The corresponding offset of the NVRAM value is read in the global variable.
4. the method according to claim 1 for improving the I/O read or write speed of IPkg program under Optware environment, feature It is, in the method:
The kernel character string address of cache is between the heap area and stack area of memory address space.
CN201510483518.XA 2015-08-07 2015-08-07 Improve the method for the I/O read or write speed of IPkg program under Optware environment Active CN105159778B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510483518.XA CN105159778B (en) 2015-08-07 2015-08-07 Improve the method for the I/O read or write speed of IPkg program under Optware environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510483518.XA CN105159778B (en) 2015-08-07 2015-08-07 Improve the method for the I/O read or write speed of IPkg program under Optware environment

Publications (2)

Publication Number Publication Date
CN105159778A CN105159778A (en) 2015-12-16
CN105159778B true CN105159778B (en) 2019-08-02

Family

ID=54800641

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510483518.XA Active CN105159778B (en) 2015-08-07 2015-08-07 Improve the method for the I/O read or write speed of IPkg program under Optware environment

Country Status (1)

Country Link
CN (1) CN105159778B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020136078A1 (en) * 2001-03-23 2002-09-26 Garner Richard P. Method and apparatus to provide real-time access to flash memory features
CN103729300A (en) * 2013-12-25 2014-04-16 华为技术有限公司 Method and related device for managing non-volatile memories
CN104077245A (en) * 2013-03-27 2014-10-01 研祥智能科技股份有限公司 NVRAM (non-volatile random access memory) control method and system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020136078A1 (en) * 2001-03-23 2002-09-26 Garner Richard P. Method and apparatus to provide real-time access to flash memory features
CN104077245A (en) * 2013-03-27 2014-10-01 研祥智能科技股份有限公司 NVRAM (non-volatile random access memory) control method and system
CN103729300A (en) * 2013-12-25 2014-04-16 华为技术有限公司 Method and related device for managing non-volatile memories

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《嵌入式Linux中NVRAM的实现方案及驱动设计》;徐立送,郭晓金;《计算机工程与设计》;20101231;第16-19页

Also Published As

Publication number Publication date
CN105159778A (en) 2015-12-16

Similar Documents

Publication Publication Date Title
US20230367711A1 (en) Systems and methods for scalable and coherent memory devices
US20230120862A1 (en) Storage System, File Storage and Reading Method, and Terminal Device
CN106020861B (en) A kind of the FOTA upgrade method and system of smartwatch
US9069656B2 (en) Obfuscating function resources while reducing stack consumption
US9836316B2 (en) Flexible acceleration of code execution
US8984207B2 (en) Memory system performing incremental merge operation and data write method
US20110145306A1 (en) Method for trimming data on non-volatile flash media
KR101511972B1 (en) Methods and apparatus for efficient communication between caches in hierarchical caching design
WO2006095184A3 (en) Data processing system
US8954707B2 (en) Automatic use of large pages
CN102169459A (en) Method, device and intelligent card for accessing data
US20050038983A1 (en) Novel flash memory arrangement
CN102902488A (en) Memory card of a handheld device and its dynamic mounting method
CN110661768A (en) Selective execution of cache line flush operations
CN103914397B (en) Flash memory device and its management method
CN110534151A (en) Realize method, apparatus, computer equipment and the storage medium wiped before write-in
US20150301865A1 (en) Hardware resource allocation for applications
CN103955389A (en) A Method of System Startup Based on PCM
KR102715658B1 (en) Systems and methods for data transfer for computational storage devices
CN105159778B (en) Improve the method for the I/O read or write speed of IPkg program under Optware environment
CN102629231A (en) Method for detecting task stack
TWI678620B (en) Storage system and storing method
CN102253884A (en) Method and device for simulating operating environment of single-plate software
CN107209720B (en) System and method for page caching and storage medium
CN102662883B (en) Machine type identification method for multi-hardware-platform FeiTeng server

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201125

Address after: Room 10242, No. 260, Jiangshu Road, Xixing street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee after: Hangzhou Jiji Intellectual Property Operation Co.,Ltd.

Address before: 201620 Shanghai city Songjiang District Sixian Road No. 3666

Patentee before: Phicomm (Shanghai) Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201214

Address after: Dai Xi Zhen Shang Qiang Lu, Wuxing District, Huzhou City, Zhejiang Province

Patentee after: HUZHOU AIDI ELECTRIC Co.,Ltd.

Address before: Room 10242, No. 260, Jiangshu Road, Xixing street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee before: Hangzhou Jiji Intellectual Property Operation Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20221228

Address after: 313000 room 1019, Xintiandi commercial office, Yishan street, Wuxing District, Huzhou, Zhejiang, China

Patentee after: Huzhou YingLie Intellectual Property Operation Co.,Ltd.

Address before: Dai Xi Zhen Shang Qiang Lu, Wuxing District, Huzhou City, Zhejiang Province

Patentee before: HUZHOU AIDI ELECTRIC Co.,Ltd.